Skip to content

Commit

Permalink
chore: Cleanups and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
TokenRat committed Sep 1, 2024
1 parent 64608d3 commit 4e3b688
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
17 changes: 13 additions & 4 deletions include/FSMGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@
#include <Arduino.h>

typedef struct {
uint8_t menuMainPointerIdx = 0; //!< MenuMain: Index of the menu cursor
uint8_t prideFlagModeIdx = 0; //!< DisplayPrideFlag: Mode selector
uint8_t animationModeIdx = 0; //!< DisplayAnimation: Mode selector
/**
* @brief MenuMain: Index of the menu cursor
*/
uint8_t menuMainPointerIdx = 0;
/**
* @brief DisplayPrideFlag: Mode selector for pride flags: 0 keep the current, 1 rotate them all
*/
uint8_t prideFlagModeIdx = 0;
/**
* @brief DisplayAnimation: Mode selector
*/
uint8_t animationModeIdx = 0;
} FSMGlobals;

#endif /* FSMGLOBALS_H_ */
#endif /* FSMGLOBALS_H_ */
2 changes: 1 addition & 1 deletion lib/EFBoard/EFBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const EFBoardPowerState EFBoardClass::resetPowerState() {
bool EFBoardClass::connectToWifi(const char *ssid, const char *password) {
LOGF_INFO("(EFBoard) Connecting to WiFi network: %s ", ssid);

// Try to connect to wifi
// Try to connect to WiFi
WiFi.begin(ssid, password);
WiFi.setSleep(true);
for (int32_t timeout_ms = 10000; timeout_ms >= 0; timeout_ms -= 200) {
Expand Down
1 change: 0 additions & 1 deletion lib/EFLed/EFLed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void EFLedClass::init(const uint8_t max_brightness) {
LOGF_DEBUG("(EFLed) Set max_brightness=%d\r\n", this->max_brightness)

enablePower();

}

void EFLedClass::enablePower() {
Expand Down
10 changes: 6 additions & 4 deletions src/states/DisplayAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <EFLed.h>
#include <EFLogging.h>
#include <EFPrideFlags.h>
#include <vector>

#include "FSMState.h"

Expand All @@ -37,7 +38,8 @@
* animation function and an associated tick rate in milliseconds.
*/
const struct {
void (DisplayAnimation::* animate)();
void (DisplayAnimation::*animate)();

const unsigned int tickrate;
} animations[DISPLAY_ANIMATION_NUM_TOTAL] = {
{.animate = &DisplayAnimation::_animateRainbowCircle, .tickrate = 20},
Expand All @@ -49,7 +51,7 @@ const struct {

};

const char* DisplayAnimation::getName() {
const char *DisplayAnimation::getName() {
return "DisplayAnimation";
}

Expand Down Expand Up @@ -132,7 +134,7 @@ void DisplayAnimation::_animateSnake() {
CRGB::Black,
};

std::rotate(pattern.rbegin(), pattern.rbegin()+this->tick % EFLED_TOTAL_NUM, pattern.rend());
std::rotate(pattern.rbegin(), pattern.rbegin() + this->tick % EFLED_TOTAL_NUM, pattern.rend());
EFLed.setAll(pattern.data());
}

Expand Down Expand Up @@ -169,6 +171,6 @@ void DisplayAnimation::_animateMatrix() {

void DisplayAnimation::_animateRainbowCircle() {
CRGB data[EFLED_TOTAL_NUM];
fill_rainbow_circular(data, EFLED_TOTAL_NUM, (tick % 128)*2, true);
fill_rainbow_circular(data, EFLED_TOTAL_NUM, (tick % 128) * 2, true);
EFLed.setAll(data);
}
1 change: 1 addition & 0 deletions src/states/DisplayPrideFlag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <EFLed.h>
#include <EFLogging.h>
#include <EFPrideFlags.h>
#include <vector>

#include "FSMState.h"

Expand Down
2 changes: 1 addition & 1 deletion src/states/MenuMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "FSMState.h"

const char* MenuMain::getName() {
const char *MenuMain::getName() {
return "MenuMain";
}

Expand Down
2 changes: 1 addition & 1 deletion src/states/menu/MenuOTAUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const char* MenuOTAUpdate::getName() {
}

void MenuOTAUpdate::entry() {
// Connecto to wifi
// Connect to WiFi
EFLed.setDragonNose(CRGB::Red);
if (EFBoard.connectToWifi(WIFI_SSID, WIFI_PASSWORD)) {
EFLed.setDragonNose(CRGB::Green);
Expand Down

0 comments on commit 4e3b688

Please sign in to comment.