Skip to content

Commit 2ed3874

Browse files
committed
Merge origin/master into ble-rewrite
2 parents b10e102 + b2280e0 commit 2ed3874

10 files changed

Lines changed: 337 additions & 231 deletions

File tree

.github/workflows/config.yml

Lines changed: 103 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,103 @@
1-
name: Continuous Integration
2-
on:
3-
push:
4-
pull_request:
5-
types: [opened, reopened, synchronize]
6-
7-
concurrency:
8-
group: ${{ github.workflow }}-${{ github.ref }}
9-
cancel-in-progress: true
10-
11-
jobs:
12-
cpplint:
13-
name: CPP Lint
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v6
17-
with:
18-
token: ${{ github.token }}
19-
show-progress: false
20-
- name: Setup Python
21-
uses: actions/setup-python@v6
22-
with:
23-
python-version: 3.x
24-
- run: pip install cpplint
25-
- run: cpplint --linelength 140 --filter=-legal/copyright,-runtime/int,-build/include_subdir,-readability/casting,-readability/todo,-build/include_order,-build/include_what_you_use --recursive ./inc/ ./lib/ ./src/
26-
27-
pio-test:
28-
name: PlatformIO Tests
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@v6
32-
with:
33-
token: ${{ secrets.GH_TOKEN }}
34-
persist-credentials: true
35-
show-progress: false
36-
- name: Setup Git Credentials
37-
run: |
38-
git config --global credential.helper store
39-
echo "https://oauth2:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials
40-
- name: Setup Python
41-
uses: actions/setup-python@v6
42-
with:
43-
python-version: 3.x
44-
- name: Cache PlatformIO
45-
uses: actions/cache@v4
46-
with:
47-
path: ~/.platformio
48-
key: pio-${{ hashFiles('platformio.ini') }}
49-
restore-keys: pio-
50-
- name: Install PlatformIO
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install -U platformio
54-
- name: Run Unit Tests
55-
run: platformio test -e native-test
56-
57-
pio-build:
58-
name: PlatformIO Build
59-
runs-on: ubuntu-latest
60-
steps:
61-
- uses: actions/checkout@v6
62-
with:
63-
token: ${{ secrets.GH_TOKEN }}
64-
persist-credentials: true
65-
show-progress: false
66-
- name: Setup Git Credentials
67-
run: |
68-
git config --global credential.helper store
69-
echo "https://oauth2:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials
70-
- name: Setup Python
71-
uses: actions/setup-python@v6
72-
with:
73-
python-version: 3.x
74-
- name: Cache PlatformIO
75-
uses: actions/cache@v4
76-
with:
77-
path: ~/.platformio
78-
key: pio-${{ hashFiles('platformio.ini') }}
79-
restore-keys: pio-
80-
- name: Install PlatformIO
81-
run: |
82-
python -m pip install --upgrade pip
83-
pip install -U platformio
84-
- name: Build ESP32S3
85-
run: platformio run -e OpenPPG-CESP32S3-CAN-SP140
86-
- name: Install esptool
87-
run: pip install esptool
88-
- name: Merge Binaries
89-
run: |
90-
esptool.py --chip esp32s3 merge_bin \
91-
-o .pio/build/OpenPPG-CESP32S3-CAN-SP140/full-controller-firmware.bin \
92-
--flash_mode dio \
93-
--flash_freq 80m \
94-
--flash_size 8MB \
95-
0x0 .pio/build/OpenPPG-CESP32S3-CAN-SP140/bootloader.bin \
96-
0x8000 .pio/build/OpenPPG-CESP32S3-CAN-SP140/partitions.bin \
97-
0xe000 /home/runner/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \
98-
0x10000 .pio/build/OpenPPG-CESP32S3-CAN-SP140/firmware.bin
99-
- name: Archive ESP32S3 Firmware
100-
uses: actions/upload-artifact@v5
101-
with:
102-
name: OpenPPG-CESP32S3-CAN-SP140-firmware
103-
path: .pio/build/OpenPPG-CESP32S3-CAN-SP140/full-controller-firmware.bin
1+
name: Continuous Integration
2+
on:
3+
push:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
cpplint:
13+
name: CPP Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
token: ${{ github.token }}
19+
show-progress: false
20+
- name: Setup Python
21+
uses: actions/setup-python@v6
22+
with:
23+
python-version: 3.x
24+
- run: pip install cpplint
25+
- run: cpplint --linelength 140 --filter=-legal/copyright,-runtime/int,-build/include_subdir,-readability/casting,-readability/todo,-build/include_order,-build/include_what_you_use --recursive ./inc/ ./lib/ ./src/
26+
27+
pio-test:
28+
name: PlatformIO Tests
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v6
32+
with:
33+
token: ${{ secrets.GH_TOKEN }}
34+
persist-credentials: true
35+
show-progress: false
36+
- name: Setup Git Credentials
37+
run: |
38+
git config --global credential.helper store
39+
echo "https://oauth2:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials
40+
- name: Setup Python
41+
uses: actions/setup-python@v6
42+
with:
43+
python-version: 3.x
44+
- name: Cache PlatformIO
45+
uses: actions/cache@v5
46+
with:
47+
path: ~/.platformio
48+
key: pio-${{ hashFiles('platformio.ini') }}
49+
restore-keys: pio-
50+
- name: Install PlatformIO
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install -U platformio
54+
- name: Run Unit Tests
55+
run: platformio test -e native-test
56+
57+
pio-build:
58+
name: PlatformIO Build
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v6
62+
with:
63+
token: ${{ secrets.GH_TOKEN }}
64+
persist-credentials: true
65+
show-progress: false
66+
- name: Setup Git Credentials
67+
run: |
68+
git config --global credential.helper store
69+
echo "https://oauth2:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials
70+
- name: Setup Python
71+
uses: actions/setup-python@v6
72+
with:
73+
python-version: 3.x
74+
- name: Cache PlatformIO
75+
uses: actions/cache@v5
76+
with:
77+
path: ~/.platformio
78+
key: pio-${{ hashFiles('platformio.ini') }}
79+
restore-keys: pio-
80+
- name: Install PlatformIO
81+
run: |
82+
python -m pip install --upgrade pip
83+
pip install -U platformio
84+
- name: Build ESP32S3
85+
run: platformio run -e OpenPPG-CESP32S3-CAN-SP140
86+
- name: Install esptool
87+
run: pip install esptool
88+
- name: Merge Binaries
89+
run: |
90+
esptool.py --chip esp32s3 merge_bin \
91+
-o .pio/build/OpenPPG-CESP32S3-CAN-SP140/full-controller-firmware.bin \
92+
--flash_mode dio \
93+
--flash_freq 80m \
94+
--flash_size 8MB \
95+
0x0 .pio/build/OpenPPG-CESP32S3-CAN-SP140/bootloader.bin \
96+
0x8000 .pio/build/OpenPPG-CESP32S3-CAN-SP140/partitions.bin \
97+
0xe000 /home/runner/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \
98+
0x10000 .pio/build/OpenPPG-CESP32S3-CAN-SP140/firmware.bin
99+
- name: Archive ESP32S3 Firmware
100+
uses: actions/upload-artifact@v6
101+
with:
102+
name: OpenPPG-CESP32S3-CAN-SP140-firmware
103+
path: .pio/build/OpenPPG-CESP32S3-CAN-SP140/full-controller-firmware.bin

inc/sp140/alert_display.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ struct AlertUIUpdate {
3232
// Counter data
3333
AlertCounts counts;
3434

35-
// Display message data
36-
SensorID displayId; // Valid sensor when showDisplay == true
37-
AlertLevel displayLevel; // Alert level for dynamic abbreviations
38-
bool displayCritical; // true = critical colouring
39-
bool showDisplay; // false = hide label
35+
// Warning display (bottom row)
36+
SensorID warningId; // Valid sensor when showWarning == true
37+
AlertLevel warningLevel; // Alert level for dynamic abbreviations
38+
bool showWarning; // false = hide warning label
39+
40+
// Critical display (top row, in altitude area)
41+
SensorID criticalId; // Valid sensor when showCritical == true
42+
AlertLevel criticalLevel; // Alert level for dynamic abbreviations
43+
bool showCritical; // false = hide critical label
4044

4145
// Critical alert state (for border/vibration control)
4246
bool criticalAlertsActive; // true = show red border + vibration

inc/sp140/esc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#define ESC_MCU_CRIT 95
1515
#define ESC_CAP_WARN 85
1616
#define ESC_CAP_CRIT 100
17-
#define MOTOR_WARN 90
18-
#define MOTOR_CRIT 110
17+
#define MOTOR_WARN 105
18+
#define MOTOR_CRIT 150
1919

2020
void initESC();
2121
void setESCThrottle(int throttlePWM);

inc/sp140/lvgl/lvgl_alerts.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ extern lv_obj_t* critical_counter_circle;
1313
extern lv_obj_t* critical_counter_label;
1414

1515
// Alert text carousel objects
16-
extern lv_obj_t* alert_text_label;
16+
extern lv_obj_t* alert_text_label; // For warning text
17+
extern lv_obj_t* critical_text_label; // For critical text (separate so both can show)
1718
extern lv_timer_t* alert_cycle_timer;
1819

1920
// Snapshot state shared between timer and external updater
@@ -29,5 +30,7 @@ void loadAlertSnapshot(const AlertSnapshot& snap);
2930
void lv_showAlertText(SensorID id, bool critical);
3031
void lv_showAlertTextWithLevel(SensorID id, AlertLevel level, bool critical);
3132
void lv_hideAlertText();
33+
void lv_hideWarningText();
34+
void lv_hideCriticalText();
3235

3336
#endif // INC_SP140_LVGL_LVGL_ALERTS_H_

inc/sp140/monitor_config.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
// This file serves as the single source of truth for all sensor monitoring thresholds.
77

88
// -- ESC Thresholds --
9-
static const Thresholds escMosTempThresholds = {.warnLow = -10, .warnHigh = 90, .critLow = -20, .critHigh = 110, .hysteresis = 2.0f};
10-
static const Thresholds escMcuTempThresholds = {.warnLow = -10, .warnHigh = 80, .critLow = -20, .critHigh = 95, .hysteresis = 2.0f};
11-
static const Thresholds escCapTempThresholds = {.warnLow = -10, .warnHigh = 85, .critLow = -20, .critHigh = 100, .hysteresis = 2.0f};
12-
static const Thresholds motorTempThresholds = {.warnLow = -20, .warnHigh = 105, .critLow = -25, .critHigh = 115, .hysteresis = 2.0f};
9+
static const Thresholds escMosTempThresholds = {.warnLow = -10, .warnHigh = 90, .critLow = -20, .critHigh = 110, .hysteresis = 1.0f};
10+
static const Thresholds escMcuTempThresholds = {.warnLow = -10, .warnHigh = 80, .critLow = -20, .critHigh = 95, .hysteresis = 1.0f};
11+
static const Thresholds escCapTempThresholds = {.warnLow = -10, .warnHigh = 85, .critLow = -20, .critHigh = 100, .hysteresis = 1.0f};
12+
static const Thresholds motorTempThresholds = {.warnLow = -20, .warnHigh = 105, .critLow = -25, .critHigh = 115, .hysteresis = 1.0f};
1313

1414
// -- BMS Thresholds --
15-
static const Thresholds bmsTempThresholds = {.warnLow = -10, .warnHigh = 50, .critLow = -15, .critHigh = 60, .hysteresis = 2.0f};
16-
static const Thresholds bmsCellTempThresholds = {.warnLow = -10, .warnHigh = 50, .critLow = -15, .critHigh = 56, .hysteresis = 2.0f};
15+
static const Thresholds bmsTempThresholds = {.warnLow = -10, .warnHigh = 50, .critLow = -15, .critHigh = 60, .hysteresis = 1.0f};
16+
static const Thresholds bmsCellTempThresholds = {.warnLow = -10, .warnHigh = 50, .critLow = -15, .critHigh = 56, .hysteresis = 1.0f};
1717
static const Thresholds bmsHighCellVoltageThresholds = {.warnLow = 0.0, .warnHigh = 4.19, .critLow = 0.0, .critHigh = 4.20};
1818
static const Thresholds bmsLowCellVoltageThresholds = {.warnLow = 3.2, .warnHigh = 4.5, .critLow = 3.0, .critHigh = 4.8};
1919
static const Thresholds bmsSOCThresholds = {.warnLow = 15.0, .warnHigh = 101.0, .critLow = 5.0, .critHigh = 110.0};
2020
static const Thresholds bmsTotalVoltageThresholds = {.warnLow = 79.2, .warnHigh = 100.4, .critLow = 69.6, .critHigh = 100.8};
2121
static const Thresholds bmsVoltageDifferentialThresholds = {.warnLow = -1.0, .warnHigh = 0.2, .critLow = -2.0, .critHigh = 0.4};
2222

2323
// -- Altimeter Thresholds --
24-
static const Thresholds baroTempThresholds = {.warnLow = 0, .warnHigh = 50, .critLow = -10, .critHigh = 80, .hysteresis = 2.0f};
24+
static const Thresholds baroTempThresholds = {.warnLow = 0, .warnHigh = 50, .critLow = -10, .critHigh = 80, .hysteresis = 1.0f};
2525

2626
// -- Internal Thresholds --
27-
static const Thresholds cpuTempThresholds = {.warnLow = 0, .warnHigh = 60, .critLow = -10, .critHigh = 80, .hysteresis = 2.0f};
27+
static const Thresholds cpuTempThresholds = {.warnLow = 0, .warnHigh = 60, .critLow = -10, .critHigh = 80, .hysteresis = 1.0f};
2828

2929
#endif // INC_SP140_MONITOR_CONFIG_H_

inc/sp140/simple_monitor.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,16 @@ struct HysteresisSensorMonitor : public SensorMonitor {
195195
break;
196196

197197
case AlertLevel::WARN_LOW:
198-
// From WARN_LOW, need to go below warnLow - hysteresis to clear
199-
// Or escalate to critical if still below critLow + hysteresis
200-
if (v <= thr.critLow + thr.hysteresis) now = AlertLevel::CRIT_LOW;
198+
// From WARN_LOW, escalate to critical at exact threshold (no hysteresis)
199+
// Use hysteresis only when clearing (de-escalating to OK)
200+
if (v <= thr.critLow) now = AlertLevel::CRIT_LOW;
201201
else if (v > thr.warnLow + thr.hysteresis) now = AlertLevel::OK;
202202
break;
203203

204204
case AlertLevel::WARN_HIGH:
205-
// From WARN_HIGH, need to go below warnHigh - hysteresis to clear
206-
// Or escalate to critical if still above critHigh - hysteresis
207-
if (v >= thr.critHigh - thr.hysteresis) now = AlertLevel::CRIT_HIGH;
205+
// From WARN_HIGH, escalate to critical at exact threshold (no hysteresis)
206+
// Use hysteresis only when clearing (de-escalating to OK)
207+
if (v >= thr.critHigh) now = AlertLevel::CRIT_HIGH;
208208
else if (v < thr.warnHigh - thr.hysteresis) now = AlertLevel::OK;
209209
break;
210210

0 commit comments

Comments
 (0)