Skip to content

Commit f9df4bd

Browse files
committed
cpplint
1 parent f241320 commit f9df4bd

File tree

12 files changed

+46
-43
lines changed

12 files changed

+46
-43
lines changed

inc/sp140/alert_display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct AlertCounts {
2020
struct AlertEvent {
2121
SensorID sensorId;
2222
AlertLevel level; // New level (OK, WARN_*, CRIT_*)
23-
uint32_t timestamp; // When event was generated (millis)
23+
uint32_t timestamp; // When event was generated (millis)
2424
};
2525

2626
// Global queues

inc/sp140/lvgl/lvgl_alerts.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LVGL_ALERTS_H
2-
#define LVGL_ALERTS_H
1+
#ifndef INC_SP140_LVGL_LVGL_ALERTS_H_
2+
#define INC_SP140_LVGL_LVGL_ALERTS_H_
33

44
#include <lvgl.h>
55
#include "../simple_monitor.h"
@@ -30,4 +30,4 @@ void lv_showAlertText(SensorID id, bool critical);
3030
void lv_showAlertTextWithLevel(SensorID id, AlertLevel level, bool critical);
3131
void lv_hideAlertText();
3232

33-
#endif // LVGL_ALERTS_H
33+
#endif // INC_SP140_LVGL_LVGL_ALERTS_H_

inc/sp140/lvgl/lvgl_core.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LVGL_CORE_H
2-
#define LVGL_CORE_H
1+
#ifndef INC_SP140_LVGL_LVGL_CORE_H_
2+
#define INC_SP140_LVGL_LVGL_CORE_H_
33

44
#include <lvgl.h>
55
#include <Adafruit_ST7735.h>
@@ -38,4 +38,4 @@ void lv_tick_handler();
3838
void updateLvgl();
3939
void displayLvglSplash(const STR_DEVICE_DATA_140_V1& deviceData, int duration);
4040

41-
#endif // LVGL_CORE_H
41+
#endif // INC_SP140_LVGL_LVGL_CORE_H_

inc/sp140/lvgl/lvgl_main_screen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LVGL_MAIN_SCREEN_H
2-
#define LVGL_MAIN_SCREEN_H
1+
#ifndef INC_SP140_LVGL_LVGL_MAIN_SCREEN_H_
2+
#define INC_SP140_LVGL_LVGL_MAIN_SCREEN_H_
33

44
#include <lvgl.h>
55
#include "lvgl_core.h"
@@ -74,4 +74,4 @@ lv_obj_t* createTempBackground(lv_obj_t* parent, int x, int y, int width, int he
7474
// Main screen setup function
7575
void setupMainScreen(bool darkMode);
7676

77-
#endif // LVGL_MAIN_SCREEN_H
77+
#endif // INC_SP140_LVGL_LVGL_MAIN_SCREEN_H_

inc/sp140/lvgl/lvgl_updates.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LVGL_UPDATES_H
2-
#define LVGL_UPDATES_H
1+
#ifndef INC_SP140_LVGL_LVGL_UPDATES_H_
2+
#define INC_SP140_LVGL_LVGL_UPDATES_H_
33

44
#include <lvgl.h>
55
#include <freertos/FreeRTOS.h>
@@ -73,4 +73,4 @@ bool isCriticalBorderFlashing();
7373
void startCriticalBorderFlashDirect();
7474
void stopCriticalBorderFlashDirect();
7575

76-
#endif // LVGL_UPDATES_H
76+
#endif // INC_SP140_LVGL_LVGL_UPDATES_H_

inc/sp140/simple_monitor.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,18 @@ struct SerialLogger : ILogger {
100100
// Multi-sink logger – forwards events to every registered ILogger sink
101101
struct MultiLogger : ILogger {
102102
std::vector<ILogger*> sinks;
103-
void addSink(ILogger* s) { if (s) sinks.push_back(s); }
103+
void addSink(ILogger* s) {
104+
if (s) sinks.push_back(s);
105+
}
104106
void log(SensorID id, AlertLevel lvl, float v) override {
105-
for (auto* s : sinks) { s->log(id, lvl, v); }
107+
for (auto* s : sinks) {
108+
s->log(id, lvl, v);
109+
}
106110
}
107111
void log(SensorID id, AlertLevel lvl, bool v) override {
108-
for (auto* s : sinks) { s->log(id, lvl, v); }
112+
for (auto* s : sinks) {
113+
s->log(id, lvl, v);
114+
}
109115
}
110116
};
111117

src/sp140/alert_display.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void initAlertDisplay() {
3535
// Create queues – small, non-blocking
3636
alertEventQueue = xQueueCreate(20, sizeof(AlertEvent));
3737
alertCarouselQueue = xQueueCreate(1, sizeof(AlertSnapshot));
38-
alertUIQueue = xQueueCreate(1, sizeof(AlertUIUpdate)); // Unified queue for synchronized updates
38+
alertUIQueue = xQueueCreate(1, sizeof(AlertUIUpdate)); // Unified queue for synchronized updates
3939

4040
if (!alertEventQueue || !alertCarouselQueue || !alertUIQueue) {
4141
USBSerial.println("[AlertDisplay] Failed creating queues");
@@ -53,7 +53,7 @@ void initAlertDisplay() {
5353
void sendAlertEvent(SensorID id, AlertLevel level) {
5454
if (!alertEventQueue) return;
5555
AlertEvent ev{ id, level, millis() };
56-
xQueueSend(alertEventQueue, &ev, 0); // best-effort, drop if full
56+
xQueueSend(alertEventQueue, &ev, 0); // best-effort, drop if full
5757
}
5858

5959
// ------------ Internal implementation -------------
@@ -92,8 +92,7 @@ static void alertAggregationTask(void* parameter) {
9292
xQueueOverwrite(alertUIQueue, &update);
9393
}
9494
}
95-
}
96-
else {
95+
} else {
9796
// If list empty ensure label hidden once
9897
static bool hideSent = false;
9998
if (!hideSent) {
@@ -110,7 +109,7 @@ static void alertAggregationTask(void* parameter) {
110109
}
111110

112111
static void recalcCountsAndPublish() {
113-
AlertCounts counts{0,0};
112+
AlertCounts counts{0, 0};
114113
std::vector<SensorID> critList;
115114
std::vector<SensorID> warnList;
116115
for (const auto& kv : g_currentLevels) {

src/sp140/bms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void updateBMSData() {
2929
if (xSemaphoreTake(spiBusMutex, pdMS_TO_TICKS(150)) != pdTRUE) {
3030
// SPI bus timeout - display might be doing long operation
3131
USBSerial.println("[BMS] SPI bus timeout - skipping BMS update cycle");
32-
return; // Use stale BMS data this cycle rather than hang
32+
return; // Use stale BMS data this cycle rather than hang
3333
}
3434
}
3535
digitalWrite(bmsCS, LOW);
@@ -80,7 +80,7 @@ void updateBMSData() {
8080

8181
bmsTelemetryData.lastUpdateMs = millis();
8282
unsigned long dur = bmsTelemetryData.lastUpdateMs - tStart;
83-
if (dur > 80) { // warn if BMS update is taking longer than a frame
83+
if (dur > 80) { // warn if BMS update is taking longer than a frame
8484
USBSerial.print("Warn: BMS update slow ");
8585
USBSerial.print(dur);
8686
USBSerial.println("ms");

src/sp140/lvgl/lvgl_alerts.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void loadAlertSnapshot(const AlertSnapshot& snap) {
2424
}
2525
const char* txt = sensorIDToAbbreviation(static_cast<SensorID>(snap.ids[0]));
2626
lv_label_set_text(alert_text_label, txt);
27-
lv_obj_set_style_text_color(alert_text_label, snap.criticalMode ? lv_color_make(255,0,0) : lv_color_make(255,165,0), 0);
27+
lv_obj_set_style_text_color(alert_text_label, snap.criticalMode ? lv_color_make(255, 0, 0) : lv_color_make(255, 165, 0), 0);
2828
lv_obj_clear_flag(alert_text_label, LV_OBJ_FLAG_HIDDEN);
2929
}
3030

@@ -105,7 +105,7 @@ void updateAlertCounterDisplay(const AlertCounts& counts) {
105105
if (counts.warningCount > 0) {
106106
char buf[4];
107107
if (counts.warningCount > 9) {
108-
strcpy(buf, "9+");
108+
snprintf(buf, sizeof(buf), "9+");
109109
} else {
110110
snprintf(buf, sizeof(buf), "%u", counts.warningCount);
111111
}
@@ -119,7 +119,7 @@ void updateAlertCounterDisplay(const AlertCounts& counts) {
119119
if (counts.criticalCount > 0) {
120120
char buf[4];
121121
if (counts.criticalCount > 9) {
122-
strcpy(buf, "9+");
122+
snprintf(buf, sizeof(buf), "9+");
123123
} else {
124124
snprintf(buf, sizeof(buf), "%u", counts.criticalCount);
125125
}
@@ -173,10 +173,10 @@ void lv_showAlertTextWithLevel(SensorID id, AlertLevel level, bool critical) {
173173
// Make warning text darker and slightly larger for readability
174174
lv_obj_set_style_text_font(alert_text_label, &lv_font_montserrat_16, 0);
175175
// Dark orange for better readability over light background
176-
lv_obj_set_style_text_color(alert_text_label, lv_color_make(200,100,0), 0);
176+
lv_obj_set_style_text_color(alert_text_label, lv_color_make(200, 100, 0), 0);
177177
}
178178
if (critical) {
179-
lv_obj_set_style_text_color(alert_text_label, lv_color_make(255,0,0), 0);
179+
lv_obj_set_style_text_color(alert_text_label, lv_color_make(255, 0, 0), 0);
180180
}
181181
lv_obj_clear_flag(alert_text_label, LV_OBJ_FLAG_HIDDEN);
182182
}

src/sp140/lvgl/lvgl_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void lvgl_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color
9292
if (xSemaphoreTake(spiBusMutex, pdMS_TO_TICKS(200)) != pdTRUE) {
9393
// SPI bus timeout - BMS might be doing long operation, skip display flush
9494
USBSerial.println("[DISPLAY] SPI bus timeout - skipping display flush");
95-
return; // Skip this display update rather than hang
95+
return; // Skip this display update rather than hang
9696
}
9797
}
9898
tft_driver->startWrite();

0 commit comments

Comments
 (0)