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

@ -31,6 +31,7 @@ jobs:
#- esp32:esp32:esp32c6
#- esp32:esp32:esp32h2
#- esp32:esp32:esp32s3
arduino-platform: esp32:esp32@3.0.0 # latest 3.0.0 version as of 5/2024
# These are the batteries for which the code will be compiled.
battery:
- BMW_I3_BATTERY
@ -80,4 +81,4 @@ jobs:
# in the build matrix, and using build flags to define the
# battery and inverter set in the build matrix.
- name: Compile Sketch
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-Wall -DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software

View file

@ -34,6 +34,7 @@ jobs:
#- esp32:esp32:esp32c6
#- esp32:esp32:esp32h2
#- esp32:esp32:esp32s3
arduino-platform: esp32:esp32@3.0.0 # latest 3.0.0 version as of 5/2024
# These are the batteries for which the code will be compiled.
battery:
- BMW_I3_BATTERY
@ -83,4 +84,4 @@ jobs:
# in the build matrix, and using build flags to define the
# battery and inverter set in the build matrix.
- name: Compile Sketch
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-Wall -DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software

View file

@ -31,6 +31,7 @@ jobs:
#- esp32:esp32:esp32c6
#- esp32:esp32:esp32h2
#- esp32:esp32:esp32s3
arduino-platform: esp32:esp32@3.0.0 # latest 3.0.0 version as of 5/2024
# These are the batteries for which the code will be compiled.
battery:
# - BMW_I3_BATTERY
@ -76,4 +77,4 @@ jobs:
# in the build matrix, and using build flags to define the
# battery and inverter set in the build matrix.
- name: Compile Sketch
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-Wall -DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software

View file

@ -192,12 +192,8 @@ void core_loop(void* task_time_us) {
TickType_t xLastWakeTime = xTaskGetTickCount();
const TickType_t xFrequency = pdMS_TO_TICKS(1); // Convert 1ms to ticks
led_init();
int64_t prev_wake;
while (true) {
int64_t now = esp_timer_get_time();
int64_t wake_period = now - prev_wake;
prev_wake = now;
START_TIME_MEASUREMENT(all);
START_TIME_MEASUREMENT(comm);
// Input

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,14 +81,15 @@ 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);