🐞 fix: 增加关于运行状态的回复数据帧。

This commit is contained in:
chenanchun 2026-03-09 16:47:41 +08:00
parent 7b17066575
commit beb9a3e4a2

View File

@ -1,11 +1,13 @@
#include "watchdog.hpp"
#include "zpp/fmt.hpp"
#include <etl/vector.h> #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/hwinfo.h>
#include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor.h>
#include <led_strip_indicator/led_strip_indicator.hpp>
#include <uart_com/protocal.hpp>
#include <zpp/device.hpp> #include <zpp/device.hpp>
#include "watchdog.hpp"
#include "zpp/fmt.hpp"
namespace { namespace {
auto sensor = DEVICE_DT_GET(DT_NODELABEL(godtek)); auto sensor = DEVICE_DT_GET(DT_NODELABEL(godtek));
auto &pmc = ZPP_DRV_GET(uart_com::Protocal, DT_NODELABEL(pm_protocal)); 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 { pmc.SetRxCallback(kRunningState, [](uart_com::DataType data) -> void {
auto state = static_cast<StatusId>(data[0]); auto state = static_cast<StatusId>(data[0]);
led_strip.Status(state).on_error([](zpp::error_code code) { pmc.Send(
zpp::println("Status Error: {}", zpp::error_str(code)); 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{}; auto wdt = app::WatchDogConfig{};
sensor_trigger tri{.type = SENSOR_TRIG_DATA_READY, sensor_trigger tri{.type = SENSOR_TRIG_DATA_READY,