forked from EmbeddedTeam/app_photomagnetic
🐞 fix: 增加关于运行状态的回复数据帧。
This commit is contained in:
parent
7b17066575
commit
beb9a3e4a2
17
src/main.cpp
17
src/main.cpp
@ -1,11 +1,13 @@
|
||||
#include "watchdog.hpp"
|
||||
#include "zpp/fmt.hpp"
|
||||
#include <etl/vector.h>
|
||||
#include <led_strip_indicator/led_strip_indicator.hpp>
|
||||
#include <uart_com/protocal.hpp>
|
||||
#include <zephyr/drivers/hwinfo.h>
|
||||
#include <zephyr/drivers/sensor.h>
|
||||
|
||||
#include <led_strip_indicator/led_strip_indicator.hpp>
|
||||
#include <uart_com/protocal.hpp>
|
||||
#include <zpp/device.hpp>
|
||||
|
||||
#include "watchdog.hpp"
|
||||
#include "zpp/fmt.hpp"
|
||||
namespace {
|
||||
auto sensor = DEVICE_DT_GET(DT_NODELABEL(godtek));
|
||||
auto &pmc = ZPP_DRV_GET(uart_com::Protocal, DT_NODELABEL(pm_protocal));
|
||||
@ -26,9 +28,10 @@ auto main(void) -> int {
|
||||
|
||||
pmc.SetRxCallback(kRunningState, [](uart_com::DataType data) -> void {
|
||||
auto state = static_cast<StatusId>(data[0]);
|
||||
led_strip.Status(state).on_error([](zpp::error_code code) {
|
||||
zpp::println("Status Error: {}", zpp::error_str(code));
|
||||
});
|
||||
pmc.Send(
|
||||
kRunningState,
|
||||
uart_com::DataType(reinterpret_cast<uint8_t *>(&state), sizeof(state)));
|
||||
led_strip.Status(state).on_error([](zpp::error_code code) {});
|
||||
});
|
||||
auto wdt = app::WatchDogConfig{};
|
||||
sensor_trigger tri{.type = SENSOR_TRIG_DATA_READY,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user