mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Merge pull request #330 from dalathegreat/improvement/compiler-warnings
Improvement: Compiler warnings
This commit is contained in:
commit
8664c817c4
8 changed files with 29 additions and 24 deletions
3
.github/workflows/compile-all-batteries.yml
vendored
3
.github/workflows/compile-all-batteries.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
3
.github/workflows/compile-all-inverters.yml
vendored
3
.github/workflows/compile-all-inverters.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue