Skip to content

Commit

Permalink
fix: 🐛 Fix usage of unintialized fields
Browse files Browse the repository at this point in the history
This should fix the data aborts that would occur when running the code. Previously the code would access fields in Gamepad that were uninitialized, leading to the code crashing.
  • Loading branch information
ion098 committed Oct 10, 2024
1 parent b2e027b commit 075c379
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/gamepad/gamepad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ class Gamepad {

void updateScreens();

std::shared_ptr<DefaultScreen> defaultScreen;
std::vector<std::shared_ptr<AbstractScreen>> screens;
ScreenBuffer currentScreen;
ScreenBuffer nextBuffer;
std::shared_ptr<DefaultScreen> defaultScreen = std::make_shared<DefaultScreen>();
std::vector<std::shared_ptr<AbstractScreen>> screens{};
ScreenBuffer currentScreen{};
ScreenBuffer nextBuffer{};
pros::Controller controller;

uint8_t last_printed_line = 0;
uint last_print_time = 0;
uint last_update_time = 0;
pros::Mutex mut;
pros::Mutex mut{};
};

inline Gamepad Gamepad::master {pros::E_CONTROLLER_MASTER};
Expand Down

0 comments on commit 075c379

Please sign in to comment.