diff --git a/lib/Domain/Gun/Gun.cpp b/lib/Domain/Gun/Gun.cpp index f4672aa..33b4c3c 100644 --- a/lib/Domain/Gun/Gun.cpp +++ b/lib/Domain/Gun/Gun.cpp @@ -63,8 +63,9 @@ void Gun::setup(void) { updateBatteryDisplayCycleCount = TICKS_BETWEEN_UI_UPDATE; ui->displaySplash(2000); - ui->displayBatteryStatus(hal->getBatteryVoltageMv(), - hal->getBatteryVoltagePercent()); + + // mV is not used + ui->displayBatteryStatus(0, hal->getBatteryVoltagePercent()); ui->displayShootCount(0); } \ No newline at end of file diff --git a/lib/Domain/Gun/Gun.hpp b/lib/Domain/Gun/Gun.hpp index 48751b0..14831c3 100644 --- a/lib/Domain/Gun/Gun.hpp +++ b/lib/Domain/Gun/Gun.hpp @@ -51,6 +51,13 @@ class Gun { void toggleCalibrationMode() { calibrationMode = !calibrationMode; } + /** + * @brief Gun loop shall be called at least each 10ms, + * but interrupt shall trigger loop() execution in + * a shorter delay. + * + */ void loop(); + void setup(); }; \ No newline at end of file diff --git a/lib/Domain/Gun/IGunUi.hpp b/lib/Domain/Gun/IGunUi.hpp index 34e0f40..30e500d 100644 --- a/lib/Domain/Gun/IGunUi.hpp +++ b/lib/Domain/Gun/IGunUi.hpp @@ -21,6 +21,7 @@ class IGunUi { public: + virtual void setup() = 0; virtual void displaySplash(uint16_t timeoutMs) = 0; virtual void displayBatteryStatus(uint16_t mv, uint8_t percent) = 0; virtual void displayChargingStatus(bool isCharging) = 0; diff --git a/lib/Domain/Gun/SSD1306Ui.hpp b/lib/Domain/Gun/SSD1306Ui.hpp index ed470ac..1de15ca 100644 --- a/lib/Domain/Gun/SSD1306Ui.hpp +++ b/lib/Domain/Gun/SSD1306Ui.hpp @@ -36,8 +36,9 @@ static Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); */ class SSD1306Ui : public IGunUi { public: - SSD1306Ui() { + SSD1306Ui() {} + void setup() override{ if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { for (;;) ; // Don't proceed, loop forever diff --git a/platformio.ini b/platformio.ini index 6315620..3998c70 100755 --- a/platformio.ini +++ b/platformio.ini @@ -19,7 +19,7 @@ lib_deps = # -cdragon_isp # -cavrispmkII -upload_command = avrdude -vv -b57600 -pm328p -c avrisp -Pcom11 $UPLOAD_FLAGS -U flash:w:$SOURCE:i +upload_command = avrdude -vv -b57600 -pm328p -c avrisp -Pcom9 $UPLOAD_FLAGS -U flash:w:$SOURCE:i # upload_protocol=custom # upload_speed=115200 diff --git a/src/GunApp.cpp b/src/GunApp.cpp index 3f2c4ab..3601672 100644 --- a/src/GunApp.cpp +++ b/src/GunApp.cpp @@ -53,7 +53,8 @@ void loop(void) { } void setup(void) { - hal.setupHeartbeat(); hal.setGun(&gun); + ui.setup(); gun.setup(); + hal.setupHeartbeat(); } \ No newline at end of file