Ready to implement GPIO logic to manage relays
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include "secure_api.h"
|
||||
#include "ethernet.h"
|
||||
#include "constants.h"
|
||||
#include "relays.h"
|
||||
|
||||
static const char *TAG = "main";
|
||||
|
||||
@ -21,7 +22,8 @@ void app_main(void)
|
||||
|
||||
ESP_LOGI(TAG, "SolarEnergy WT32-ETH01 device");
|
||||
|
||||
// TODO : turn off all relays
|
||||
// Turn off all relays
|
||||
relays_turn_off_all();
|
||||
|
||||
// Initialize storage
|
||||
if (storage_init() == false)
|
||||
@ -182,7 +184,7 @@ void app_main(void)
|
||||
if (fails > 5)
|
||||
{
|
||||
ESP_LOGE(TAG, "Many failures, will stop all relays...");
|
||||
// TODO : turn off all relays
|
||||
relays_turn_off_all();
|
||||
}
|
||||
|
||||
// Restart the card after too much failures
|
||||
@ -199,9 +201,13 @@ void app_main(void)
|
||||
|
||||
fails = 0;
|
||||
|
||||
// TODO : apply sync
|
||||
sync_response_print(res);
|
||||
|
||||
for (size_t i = 0; i < DEV_MAX_RELAYS; i++)
|
||||
{
|
||||
relays_set(i, sync_response_is_relay_on(res, i));
|
||||
}
|
||||
|
||||
sync_response_free(res);
|
||||
system_sleep(SYNC_TIME_INTERVAL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user