cleanup main
This commit is contained in:
parent
ea9cd3cf63
commit
03fe849fec
@ -43,6 +43,9 @@ void taskControl(void *pvParameters)
|
|||||||
if (getSafetyState() == SAFETY_NO_ERROR)
|
if (getSafetyState() == SAFETY_NO_ERROR)
|
||||||
{
|
{
|
||||||
// TODO: control the burner based on timetable
|
// TODO: control the burner based on timetable
|
||||||
|
|
||||||
|
setCirculationPumpState(DISABLED);
|
||||||
|
setBurnerState(ENABLED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
64
main/main.c
64
main/main.c
@ -16,6 +16,7 @@
|
|||||||
#include "metrics.h"
|
#include "metrics.h"
|
||||||
#include "outputs.h"
|
#include "outputs.h"
|
||||||
#include "inputs.h"
|
#include "inputs.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
#define I2C_MASTER_SCL 19
|
#define I2C_MASTER_SCL 19
|
||||||
#define I2C_MASTER_SDA 18
|
#define I2C_MASTER_SDA 18
|
||||||
@ -35,74 +36,15 @@ void app_main(void)
|
|||||||
}
|
}
|
||||||
ESP_ERROR_CHECK(ret);
|
ESP_ERROR_CHECK(ret);
|
||||||
|
|
||||||
|
// TODO: Error handling!
|
||||||
initOutputs();
|
initOutputs();
|
||||||
initInputs();
|
initInputs();
|
||||||
initSafety();
|
initSafety();
|
||||||
|
initControl();
|
||||||
initMetrics();
|
initMetrics();
|
||||||
|
|
||||||
/*TODO: will be done by safety on the future*/
|
|
||||||
setCirculationPumpState(DISABLED);
|
|
||||||
setBurnerState(DISABLED);
|
|
||||||
|
|
||||||
ESP_LOGI(TAG, "running main loop now");
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
vTaskDelay(pdMS_TO_TICKS(2048));
|
vTaskDelay(pdMS_TO_TICKS(2048));
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
if (getBurnerError() == FAULT)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner FAULT");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner OK");
|
|
||||||
}
|
|
||||||
setCirculationPumpState(ENABLED);
|
|
||||||
setBurnerState(ENABLED);
|
|
||||||
|
|
||||||
if (getBurnerState() == ENABLED)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner ENABLED");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner DISABLED");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getCirculationPumpState() == ENABLED)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "CirculationPump ENABLED");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "CirculationPump DISABLED");
|
|
||||||
}
|
|
||||||
|
|
||||||
ESP_LOGI(TAG,"\n");
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
|
||||||
setCirculationPumpState(DISABLED);
|
|
||||||
setBurnerState(DISABLED);
|
|
||||||
|
|
||||||
if (getBurnerState() == ENABLED)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner ENABLED");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Burner DISABLED");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getCirculationPumpState() == ENABLED)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "CirculationPump ENABLED");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "CirculationPump DISABLED");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,6 +46,8 @@ void initSafety(void)
|
|||||||
{
|
{
|
||||||
ESP_LOGE(TAG, "Failed to create task");
|
ESP_LOGE(TAG, "Failed to create task");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSafeState(); // Set inital state
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskSafety(void *pvParameters)
|
void taskSafety(void *pvParameters)
|
||||||
|
Loading…
Reference in New Issue
Block a user