43 lines
922 B
Markdown
43 lines
922 B
Markdown
|
|
## Exercise 08: SystemStartup Package Scaffold
|
||
|
|
|
||
|
|
This exercise starts a reusable `SystemStartup` package that is intended to be shared by future exercises and field firmware.
|
||
|
|
|
||
|
|
Current package responsibilities:
|
||
|
|
|
||
|
|
1. Initialize OLED and show boot/status messages.
|
||
|
|
2. Initialize SD startup watcher.
|
||
|
|
3. Keep SD monitoring active in `loop()` with a single call.
|
||
|
|
|
||
|
|
Current integration pattern:
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
#include "SystemStartup.h"
|
||
|
|
|
||
|
|
static SystemStartup g_systemStartup(Serial);
|
||
|
|
|
||
|
|
void setup() {
|
||
|
|
Serial.begin(115200);
|
||
|
|
g_systemStartup.begin();
|
||
|
|
}
|
||
|
|
|
||
|
|
void loop() {
|
||
|
|
g_systemStartup.update();
|
||
|
|
delay(10);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
This is the foundation for adding more startup subsystems (RTC sync/check, etc.) behind the same `begin()/update()` API.
|
||
|
|
|
||
|
|
## Build
|
||
|
|
|
||
|
|
```bash
|
||
|
|
source /home/jlpoole/rnsenv/bin/activate
|
||
|
|
pio run -e node_a
|
||
|
|
```
|
||
|
|
|
||
|
|
## Upload
|
||
|
|
|
||
|
|
```bash
|
||
|
|
source /home/jlpoole/rnsenv/bin/activate
|
||
|
|
pio run -e node_a -t upload --upload-port /dev/ttyACM0
|
||
|
|
```
|