89 lines
2.2 KiB
Markdown
89 lines
2.2 KiB
Markdown
# TSM_PicoW_Sensor
|
|
This project uses the PicoW board to publish sensor values (humidity and temperature) to an MQTT broker.
|
|
|
|
## Target Configuration
|
|
|
|
Use a serial terminal (baud rate: 115200) to configure the board by sending commands. The application stores the parameters in flash memory. You must restart the device to apply any changes.
|
|
|
|
### Wi-Fi
|
|
|
|
```shell
|
|
McuMinINI write settings.ini WiFi ssid "YOUR_SSID"
|
|
McuMinINI write settings.ini WiFi pass "YOUR_PASSWORD"
|
|
```
|
|
|
|
### MQTT
|
|
|
|
Broker information:
|
|
```shell
|
|
McuMinINI write settings.ini MQTT broker "BROKER_NAME"
|
|
McuMinINI write settings.ini MQTT user "USERNAME"
|
|
McuMinINI write settings.ini MQTT pass "PASSWORD"
|
|
```
|
|
|
|
Topic names:
|
|
```shell
|
|
McuMinINI write settings.ini MQTT topic_sensor_update "<user>/<room>/<device>/update"
|
|
McuMinINI write settings.ini MQTT topic_send_measurement "<user>/<room>/<device>/cmd/measure"
|
|
```
|
|
|
|
## Build
|
|
Project has `Debug`, `Release` and `Test` targets, using CMake Presets.
|
|
|
|
**Configure:**
|
|
```shell
|
|
cmake --list-presets
|
|
cmake --preset Debug
|
|
cmake --preset Release
|
|
cmake --preset Test
|
|
```
|
|
|
|
**Build:**
|
|
```shell
|
|
cmake --build --list-presets
|
|
cmake --build --preset app-debug
|
|
cmake --build --preset app-release
|
|
cmake --build --preset app-test
|
|
```
|
|
|
|
**Test:**
|
|
```shell
|
|
ctest --list-presets
|
|
ctest --test-dir build/Test -R Led_1
|
|
```
|
|
|
|
**Workflow:**
|
|
```shell
|
|
cmake --workflow --list-presets
|
|
```
|
|
|
|
## Running Tests on Another Machine
|
|
|
|
To run tests on a target connected to another machine (e.g., in a GitLab CI pipeline), follow these steps:
|
|
|
|
### On the Host Machine
|
|
|
|
Set up a J-Link tunnel to make the target accessible from anywhere:
|
|
|
|
```shell
|
|
JLinkRemoteServerCL -UseTunnel -TunnelBySN
|
|
```
|
|
|
|
The terminal output should look like this:
|
|
|
|
```
|
|
2025-06-04 08:43:57 - Remote Server started
|
|
2025-06-04 08:43:57 - Connected to J-Link with S/N 801000372
|
|
2025-06-04 08:43:57 - Resolving tunnel server name (jlink-europe.segger.com)...
|
|
2025-06-04 08:43:57 - Tunnel server IP: 185.162.249.2
|
|
2025-06-04 08:43:57 - Registered at tunnel server
|
|
2025-06-04 08:43:57 - Waiting for client connection
|
|
```
|
|
|
|
`801000372` is the tunnel ID required to reach the target. Include it in your CMake command:
|
|
|
|
```shell
|
|
cmake --preset Test -DTUNNEL_ID=801000372
|
|
```
|
|
|
|
When you run the tests, they will automatically execute on the host machine. |