clang-format
This commit is contained in:
parent
8bc863b648
commit
381c994449
5 changed files with 98 additions and 150 deletions
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* @package Opentherm library for ESP-IDF framework - EXAMPLE
|
||||
* @author: Mikhail Sazanof
|
||||
* @copyright Copyright (C) 2024 - Sazanof.ru
|
||||
* @licence MIT
|
||||
*/
|
||||
* @package Opentherm library for ESP-IDF framework - EXAMPLE
|
||||
* @author: Mikhail Sazanof
|
||||
* @copyright Copyright (C) 2024 - Sazanof.ru
|
||||
* @licence MIT
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "opentherm.h"
|
||||
#include <esp_log.h>
|
||||
#include <esp_err.h>
|
||||
#include <esp_log.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define GPIO_OT_IN CONFIG_OT_IN_PIN
|
||||
#define GPIO_OT_OUT CONFIG_OT_OUT_PIN
|
||||
|
@ -33,22 +33,19 @@ static void IRAM_ATTR esp_ot_process_response_callback(unsigned long response, o
|
|||
|
||||
void esp_ot_control_task_handler(void *pvParameter)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
unsigned long status = esp_ot_set_boiler_status(false, true, false, false, false);
|
||||
|
||||
ESP_LOGI(T, "====== OPENTHERM =====");
|
||||
ESP_LOGI(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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (fault) {
|
||||
ot_reset();
|
||||
}
|
||||
esp_ot_set_boiler_temperature(targetCHTemp);
|
||||
|
@ -71,22 +68,15 @@ void esp_ot_control_task_handler(void *pvParameter)
|
|||
|
||||
float slaveOTVersion = esp_ot_get_slave_ot_version();
|
||||
ESP_LOGI(T, "Slave OT Version: %.1f", slaveOTVersion);
|
||||
}
|
||||
else if (esp_ot_response_status == OT_STATUS_TIMEOUT)
|
||||
{
|
||||
} else if (esp_ot_response_status == OT_STATUS_TIMEOUT) {
|
||||
ESP_LOGE(T, "OT Communication Timeout");
|
||||
}
|
||||
else if (esp_ot_response_status == OT_STATUS_INVALID)
|
||||
{
|
||||
} else if (esp_ot_response_status == OT_STATUS_INVALID) {
|
||||
ESP_LOGE(T, "OT Communication Invalid");
|
||||
}
|
||||
else if (esp_ot_response_status == OT_STATUS_NONE)
|
||||
{
|
||||
} else if (esp_ot_response_status == OT_STATUS_NONE) {
|
||||
ESP_LOGE(T, "OpenTherm not initialized");
|
||||
}
|
||||
|
||||
if (fault)
|
||||
{
|
||||
if (fault) {
|
||||
ESP_LOGE(T, "Fault Code: %i", esp_ot_get_fault());
|
||||
}
|
||||
ESP_LOGI(T, "Free heap size after: %ld", esp_get_free_heap_size());
|
||||
|
@ -98,11 +88,7 @@ void esp_ot_control_task_handler(void *pvParameter)
|
|||
|
||||
void app_main()
|
||||
{
|
||||
esp_ot_init(
|
||||
GPIO_OT_IN,
|
||||
GPIO_OT_OUT,
|
||||
false,
|
||||
esp_ot_process_response_callback);
|
||||
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);
|
||||
vTaskSuspend(NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue