From 908550b1c264a521daa946f89cb70d3a85b2a8de Mon Sep 17 00:00:00 2001 From: zwsd Date: Mon, 26 Sep 2022 19:23:51 +0800 Subject: [PATCH] update --- main/app_main.cpp | 2 ++ main/heating_plate.c | 6 ++++-- main/heating_plate.h | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/main/app_main.cpp b/main/app_main.cpp index 5609cde..2228d9f 100644 --- a/main/app_main.cpp +++ b/main/app_main.cpp @@ -74,8 +74,10 @@ extern "C" void app_main(void) T_key_init(&T_key_structer); T_wifi_init(); T_temp_init(); + T_key_registered_cb(process_key_event); T_wifi_registered_cb(); + T_heating_plate_registered_cb(T_temp_get_data); while (true) { diff --git a/main/heating_plate.c b/main/heating_plate.c index e431206..024d554 100644 --- a/main/heating_plate.c +++ b/main/heating_plate.c @@ -11,12 +11,14 @@ #include "heating_plate.h" +static get_temp_callback_t get_temp_cb_s; + void T_heating_plate_init(void) {} -void T_heating_plate_registered_cb(void) {} +void T_heating_plate_registered_cb(get_temp_callback_t cb) { get_temp_cb_s = cb; } void T_heating_plate_start(void) {} void T_heating_plate_stop(void) {} -void T_heating_plate_schedule(void) {} \ No newline at end of file +void T_heating_plate_schedule(void) { get_temp_cb_s(); } \ No newline at end of file diff --git a/main/heating_plate.h b/main/heating_plate.h index e2d21c8..ced47c9 100644 --- a/main/heating_plate.h +++ b/main/heating_plate.h @@ -6,8 +6,10 @@ typedef struct bool heating_plate_preheat_finished_flag; } heating_plate_structer_t; +typedef double(*get_temp_callback_t)(void); + void T_heating_plate_init(void); -void T_heating_plate_registered_cb(void); +void T_heating_plate_registered_cb(get_temp_callback_t cb); void T_heating_plate_start(void); void T_heating_plate_stop(void); void T_heating_plate_schedule(void); \ No newline at end of file