Browse Source

update

Finny_test
zwsd 3 years ago
parent
commit
680a7920f6
  1. 3
      .vscode/settings.json
  2. 2
      main/app_main.cpp
  3. 24
      main/heating_plate.c
  4. 3
      main/heating_plate.h

3
.vscode/settings.json

@ -10,6 +10,7 @@
"esp_bt_main.h": "c",
"esp_bt_defs.h": "c",
"camera.h": "c",
"key.h": "c"
"key.h": "c",
"heating_plate.h": "c"
}
}

2
main/app_main.cpp

@ -41,6 +41,7 @@ T_key_structer_t T_key_structer = {
* ***************************************************heating_plate*************************************************** *
***********************************************************************************************************************/
heating_plate_structer_t heating_plate_structer = {
.heating_plate_preheat_start_flag = false,
.heating_plate_preheat_finished_flag = false,
};
@ -74,6 +75,7 @@ extern "C" void app_main(void)
T_key_init(&T_key_structer);
T_wifi_init();
T_temp_init();
T_heating_plate_init(&heating_plate_structer);
T_key_registered_cb(process_key_event);
T_wifi_registered_cb();

24
main/heating_plate.c

@ -11,9 +11,16 @@
#include "heating_plate.h"
#define heating_plate_target_temp 48.0
#define heating_plate_variable_temperature_range 0.5
static heating_plate_structer_t *heating_plate_structer_s;
static get_temp_callback_t get_temp_cb_s;
void T_heating_plate_init(void) {}
void T_heating_plate_init(heating_plate_structer_t *heating_plate_structer)
{
heating_plate_structer_s = heating_plate_structer;
}
void T_heating_plate_registered_cb(get_temp_callback_t cb) { get_temp_cb_s = cb; }
@ -21,4 +28,17 @@ void T_heating_plate_start(void) {}
void T_heating_plate_stop(void) {}
void T_heating_plate_schedule(void) { get_temp_cb_s(); }
void T_heating_plate_schedule(void)
{
if (heating_plate_structer_s->heating_plate_preheat_start_flag)
{
if (get_temp_cb_s() >= heating_plate_target_temp + heating_plate_variable_temperature_range)
{
T_heating_plate_stop();
}
else if (get_temp_cb_s() <= heating_plate_target_temp - heating_plate_variable_temperature_range)
{
T_heating_plate_start();
}
}
}

3
main/heating_plate.h

@ -3,12 +3,13 @@
typedef struct
{
bool heating_plate_preheat_start_flag;
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_init(heating_plate_structer_t *heating_plate_structer);
void T_heating_plate_registered_cb(get_temp_callback_t cb);
void T_heating_plate_start(void);
void T_heating_plate_stop(void);
Loading…
Cancel
Save