Prefix global variables
This commit is contained in:
parent
afd998adb6
commit
c74c1a6970
2 changed files with 104 additions and 104 deletions
|
@ -16,13 +16,13 @@
|
|||
#define GPIO_OT_OUT CONFIG_OT_OUT_PIN
|
||||
#define ESP_INTR_FLAG_DEFAULT 0
|
||||
|
||||
volatile float dhwTemp = 0;
|
||||
volatile float chTemp = 0;
|
||||
volatile bool fault = false;
|
||||
static int targetDHWTemp = 59;
|
||||
static int targetCHTemp = 60;
|
||||
volatile float g_dhwTemp = 0;
|
||||
volatile float g_chTemp = 0;
|
||||
volatile bool g_fault = false;
|
||||
static int g_targetDHWTemp = 59;
|
||||
static int g_targetCHTemp = 60;
|
||||
|
||||
static const char *T = "OT";
|
||||
static const char *g_T = "OT";
|
||||
|
||||
static void IRAM_ATTR esp_ot_process_response_callback(unsigned long response, open_therm_response_status_t esp_ot_response_status)
|
||||
{
|
||||
|
@ -36,51 +36,51 @@ void esp_ot_control_task_handler(void *pvParameter)
|
|||
while (1) {
|
||||
unsigned long status = esp_ot_set_boiler_status(false, false, false, false, false);
|
||||
|
||||
ESP_LOGI(T, "====== OPENTHERM =====");
|
||||
ESP_LOGI(T, "Free heap size before: %ld", esp_get_free_heap_size());
|
||||
ESP_LOGI(g_T, "====== OPENTHERM =====");
|
||||
ESP_LOGI(g_T, "Free heap size before: %ld", esp_get_free_heap_size());
|
||||
open_therm_response_status_t esp_ot_response_status = esp_ot_get_last_response_status();
|
||||
if (esp_ot_response_status == OT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(T, "Central Heating: %s", esp_ot_is_central_heating_active(status) ? "ON" : "OFF");
|
||||
ESP_LOGI(T, "Hot Water: %s", esp_ot_is_hot_water_active(status) ? "ON" : "OFF");
|
||||
ESP_LOGI(T, "Flame: %s", esp_ot_is_flame_on(status) ? "ON" : "OFF");
|
||||
fault = esp_ot_is_fault(status);
|
||||
ESP_LOGI(T, "Fault: %s", fault ? "YES" : "NO");
|
||||
if (fault) {
|
||||
ESP_LOGI(g_T, "Central Heating: %s", esp_ot_is_central_heating_active(status) ? "ON" : "OFF");
|
||||
ESP_LOGI(g_T, "Hot Water: %s", esp_ot_is_hot_water_active(status) ? "ON" : "OFF");
|
||||
ESP_LOGI(g_T, "Flame: %s", esp_ot_is_flame_on(status) ? "ON" : "OFF");
|
||||
g_fault = esp_ot_is_fault(status);
|
||||
ESP_LOGI(g_T, "Fault: %s", g_fault ? "YES" : "NO");
|
||||
if (g_fault) {
|
||||
ot_reset();
|
||||
}
|
||||
esp_ot_set_boiler_temperature(targetCHTemp);
|
||||
ESP_LOGI(T, "Set CH Temp to: %i", targetCHTemp);
|
||||
esp_ot_set_boiler_temperature(g_targetCHTemp);
|
||||
ESP_LOGI(g_T, "Set CH Temp to: %i", g_targetCHTemp);
|
||||
|
||||
esp_ot_set_dhw_setpoint(targetDHWTemp);
|
||||
ESP_LOGI(T, "Set DHW Temp to: %i", targetDHWTemp);
|
||||
esp_ot_set_dhw_setpoint(g_targetDHWTemp);
|
||||
ESP_LOGI(g_T, "Set DHW Temp to: %i", g_targetDHWTemp);
|
||||
|
||||
dhwTemp = esp_ot_get_dhw_temperature();
|
||||
ESP_LOGI(T, "DHW Temp: %.1f", dhwTemp);
|
||||
g_dhwTemp = esp_ot_get_dhw_temperature();
|
||||
ESP_LOGI(g_T, "DHW Temp: %.1f", g_dhwTemp);
|
||||
|
||||
chTemp = esp_ot_get_boiler_temperature();
|
||||
ESP_LOGI(T, "CH Temp: %.1f", chTemp);
|
||||
g_chTemp = esp_ot_get_boiler_temperature();
|
||||
ESP_LOGI(g_T, "CH Temp: %.1f", g_chTemp);
|
||||
|
||||
float pressure = esp_ot_get_pressure();
|
||||
ESP_LOGI(T, "Pressure: %.1f", pressure);
|
||||
ESP_LOGI(g_T, "Pressure: %.1f", pressure);
|
||||
|
||||
unsigned long slaveProductVersion = esp_ot_get_slave_product_version();
|
||||
ESP_LOGI(T, "Slave Version: %08lX", slaveProductVersion);
|
||||
ESP_LOGI(g_T, "Slave Version: %08lX", slaveProductVersion);
|
||||
|
||||
float slaveOTVersion = esp_ot_get_slave_ot_version();
|
||||
ESP_LOGI(T, "Slave OT Version: %.1f", slaveOTVersion);
|
||||
ESP_LOGI(g_T, "Slave OT Version: %.1f", slaveOTVersion);
|
||||
} else if (esp_ot_response_status == OT_STATUS_TIMEOUT) {
|
||||
ESP_LOGE(T, "OT Communication Timeout");
|
||||
ESP_LOGE(g_T, "OT Communication Timeout");
|
||||
} else if (esp_ot_response_status == OT_STATUS_INVALID) {
|
||||
ESP_LOGE(T, "OT Communication Invalid");
|
||||
ESP_LOGE(g_T, "OT Communication Invalid");
|
||||
} else if (esp_ot_response_status == OT_STATUS_NONE) {
|
||||
ESP_LOGE(T, "OpenTherm not initialized");
|
||||
ESP_LOGE(g_T, "OpenTherm not initialized");
|
||||
}
|
||||
|
||||
if (fault) {
|
||||
ESP_LOGE(T, "Fault Code: %i", esp_ot_get_fault());
|
||||
if (g_fault) {
|
||||
ESP_LOGE(g_T, "Fault Code: %i", esp_ot_get_fault());
|
||||
}
|
||||
ESP_LOGI(T, "Free heap size after: %ld", esp_get_free_heap_size());
|
||||
ESP_LOGI(T, "====== OPENTHERM =====\r\n\r\n");
|
||||
ESP_LOGI(g_T, "Free heap size after: %ld", esp_get_free_heap_size());
|
||||
ESP_LOGI(g_T, "====== OPENTHERM =====\r\n\r\n");
|
||||
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
@ -90,6 +90,6 @@ void app_main()
|
|||
{
|
||||
esp_ot_init(GPIO_OT_IN, GPIO_OT_OUT, false, esp_ot_process_response_callback);
|
||||
|
||||
xTaskCreate(esp_ot_control_task_handler, T, configMINIMAL_STACK_SIZE * 4, NULL, 3, NULL);
|
||||
xTaskCreate(esp_ot_control_task_handler, g_T, configMINIMAL_STACK_SIZE * 4, NULL, 3, NULL);
|
||||
vTaskSuspend(NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue