Merge pull request #330 from dalathegreat/improvement/compiler-warnings

Improvement: Compiler warnings
This commit is contained in:
Daniel Öster 2024-06-04 18:04:33 +03:00 committed by GitHub
commit 8664c817c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 29 additions and 24 deletions

View file

@ -30,7 +30,6 @@ led_color led_get_color() {
}
void LED::exe(void) {
static bool test_all_colors = true;
// Don't run too often
if (!timer.elapsed()) {
return;
@ -93,7 +92,6 @@ void LED::classic_run(void) {
void LED::flow_run(void) {
// Determine how bright the LED should be
bool power_positive;
int16_t power_W = datalayer.battery.status.active_power_W;
if (power_W < -50) {
// Discharging
@ -178,7 +176,6 @@ void LED::rainbow_run(void) {
}
// Assemble the color
uint32_t color = (static_cast<uint32_t>(r) << 16) | (static_cast<uint32_t>(g) << 8) | b;
pixels.setPixelColor(0, pixels.Color(r, g, b)); // RGB
}

View file

@ -13,14 +13,19 @@ class LED {
led_color color = led_color::GREEN;
LED()
: mode(led_mode::CLASSIC),
: pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
max_brightness(LED_MAX_BRIGHTNESS),
pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
brightness(LED_MAX_BRIGHTNESS),
mode(led_mode::CLASSIC),
state(LED_NORMAL),
timer(LED_EXECUTION_FREQUENCY) {}
LED(led_mode mode)
: mode(mode),
: pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
max_brightness(LED_MAX_BRIGHTNESS),
pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
brightness(LED_MAX_BRIGHTNESS),
mode(mode),
state(LED_NORMAL),
timer(LED_EXECUTION_FREQUENCY) {}
void exe(void);
@ -30,7 +35,7 @@ class LED {
Adafruit_NeoPixel pixels;
uint8_t max_brightness;
uint8_t brightness;
led_mode mode = led_mode::CLASSIC;
led_mode mode;
led_state state = LED_NORMAL;
MyTimer timer;
@ -46,4 +51,4 @@ void led_init(void);
void led_exe(void);
led_color led_get_color(void);
#endif
#endif // LED_H_

View file

@ -346,6 +346,9 @@ void init_WiFi_STA(const char* ssid, const char* password, const uint8_t wifi_ch
WiFi.begin(ssid, password, wifi_channel);
WiFi.setAutoReconnect(true); // Enable auto reconnect
wl_status_t result = static_cast<wl_status_t>(WiFi.waitForConnectResult(INIT_WIFI_CONNECT_TIMEOUT));
if (result) {
//TODO: Add event or serial print?
}
}
// Function to initialize ElegantOTA

View file

@ -81,16 +81,17 @@ class ISA
char buffer[9];
char bigbuffer[90];
uint32_t inbox;
CAN_frame_t outframe = {.FIR = {.B =
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x411,
.data = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
CAN_frame_t outframe = {
.FIR = {.B = {
.DLC = 8,
.unknown_2 = 0,
.RTR = CAN_no_RTR,
.FF = CAN_frame_std,
}},
.MsgID = 0x411,
.data = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
void printCAN(CAN_frame_t *frame);
void handle521(CAN_frame_t *frame);
void handle522(CAN_frame_t *frame);