add mosquitto example
This commit is contained in:
parent
8620bac46e
commit
77d293353e
@ -105,6 +105,17 @@ In order to decode a message, apply the above steps in reverse order.
|
||||
|
||||
All configuration is read on startup of the microcontroller.
|
||||
|
||||
## MQTT
|
||||
|
||||
To read and decode the MQTT messages one can use for example mosquitto as
|
||||
follows (using the test.mosquitto.org broker):
|
||||
|
||||
```
|
||||
mosquitto_sub -h test.mosquitto.org -p 1883 -t "temps/potato" | perl -e 'while(read(STDIN,$b,4)){printf "%.2f\n", unpack("f<",$b)}'
|
||||
```
|
||||
|
||||
The perl magic is for decoding the floating point little endian representation.
|
||||
|
||||
## Outlook
|
||||
|
||||
- Pull the flash/config handling into separate library for testability
|
||||
|
@ -8,6 +8,7 @@ use serial_comm::{cobs, protocol::set_config::SetConfig};
|
||||
use crate::flash::{Config, FlashError};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct Utf8Error(pub core::str::Utf8Error);
|
||||
|
||||
impl Format for Utf8Error {
|
||||
|
@ -13,7 +13,6 @@ use embassy_executor::Spawner;
|
||||
use embassy_net::Stack;
|
||||
use embassy_time::Timer;
|
||||
use flash::{Config, FlashError};
|
||||
use mqtt_protocol::publish::MAX_TOPIC_LENGTH;
|
||||
use static_cell::StaticCell;
|
||||
use temperature::{temperature_task, Temperature};
|
||||
use usb_serial::{init_usb, usb_task};
|
||||
|
Loading…
Reference in New Issue
Block a user