Customize it to fit the hardware.
This commit is contained in:
parent
381c994449
commit
afd998adb6
5 changed files with 24 additions and 14 deletions
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
|||
.devcontainer
|
||||
.vscode
|
||||
.cache
|
||||
build
|
||||
sdkconfig.old
|
||||
.devcontainer/
|
||||
.cache/
|
||||
build/
|
||||
CMakeFiles/
|
||||
|
||||
CMakeCache.txt
|
||||
sdkconfig.old
|
||||
|
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"sonarlint.pathToCompileCommands": "${workspaceFolder}/build/compile_commands.json"
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "opentherm.h"
|
||||
#include "esp_log.h"
|
||||
#include "hal/gpio_types.h"
|
||||
#include "rom/ets_sys.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -58,7 +59,7 @@ esp_err_t esp_ot_init(
|
|||
io_conf.pin_bit_mask = (1ULL << pin_in);
|
||||
io_conf.intr_type = GPIO_INTR_ANYEDGE;
|
||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||
io_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||
gpio_config(&io_conf);
|
||||
|
||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||
|
@ -385,11 +386,15 @@ float esp_ot_get_slave_ot_version()
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
#define OT_INPUT_ACTIVE 0
|
||||
#define OT_INPUT_INACTIVE 1
|
||||
|
||||
void IRAM_ATTR esp_ot_handle_interrupt()
|
||||
{
|
||||
// ESP_DRAM_LOGI("esp_ot_handle_interrupt", "%ld", status);
|
||||
if (esp_ot_is_ready()) {
|
||||
if (esp_ot_is_slave && esp_ot_read_state() == 1) {
|
||||
if (esp_ot_is_slave && esp_ot_read_state() == OT_INPUT_ACTIVE) {
|
||||
esp_ot_status = OT_RESPONSE_WAITING;
|
||||
} else {
|
||||
return;
|
||||
|
@ -398,7 +403,7 @@ void IRAM_ATTR esp_ot_handle_interrupt()
|
|||
|
||||
unsigned long newTs = esp_timer_get_time();
|
||||
if (esp_ot_status == OT_RESPONSE_WAITING) {
|
||||
if (esp_ot_read_state() == 1) {
|
||||
if (esp_ot_read_state() == OT_INPUT_ACTIVE) {
|
||||
// ESP_DRAM_LOGI("BIT", "Set start bit");
|
||||
esp_ot_status = OT_RESPONSE_START_BIT;
|
||||
esp_ot_response_timestamp = newTs;
|
||||
|
@ -408,7 +413,7 @@ void IRAM_ATTR esp_ot_handle_interrupt()
|
|||
esp_ot_response_timestamp = newTs;
|
||||
}
|
||||
} else if (esp_ot_status == OT_RESPONSE_START_BIT) {
|
||||
if ((newTs - esp_ot_response_timestamp < 750) && esp_ot_read_state() == 0) {
|
||||
if ((newTs - esp_ot_response_timestamp < 750) && esp_ot_read_state() == OT_INPUT_INACTIVE) {
|
||||
esp_ot_status = OT_RESPONSE_RECEIVING;
|
||||
esp_ot_response_timestamp = newTs;
|
||||
esp_ot_response_bit_index = 0;
|
||||
|
@ -419,7 +424,7 @@ void IRAM_ATTR esp_ot_handle_interrupt()
|
|||
} else if (esp_ot_status == OT_RESPONSE_RECEIVING) {
|
||||
if ((newTs - esp_ot_response_timestamp) > 750) {
|
||||
if (esp_ot_response_bit_index < 32) {
|
||||
response = (response << 1) | !esp_ot_read_state();
|
||||
response = (response << 1) | (esp_ot_read_state() == OT_INPUT_INACTIVE);
|
||||
esp_ot_response_timestamp = newTs;
|
||||
esp_ot_response_bit_index++;
|
||||
} else { // stop bit
|
||||
|
|
|
@ -34,7 +34,7 @@ static void IRAM_ATTR esp_ot_process_response_callback(unsigned long response, o
|
|||
void esp_ot_control_task_handler(void *pvParameter)
|
||||
{
|
||||
while (1) {
|
||||
unsigned long status = esp_ot_set_boiler_status(false, true, false, false, false);
|
||||
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());
|
||||
|
@ -61,7 +61,7 @@ void esp_ot_control_task_handler(void *pvParameter)
|
|||
ESP_LOGI(T, "CH Temp: %.1f", chTemp);
|
||||
|
||||
float pressure = esp_ot_get_pressure();
|
||||
ESP_LOGI(T, "Slave OT Version: %.1f", pressure);
|
||||
ESP_LOGI(T, "Pressure: %.1f", pressure);
|
||||
|
||||
unsigned long slaveProductVersion = esp_ot_get_slave_product_version();
|
||||
ESP_LOGI(T, "Slave Version: %08lX", slaveProductVersion);
|
||||
|
|
|
@ -561,8 +561,8 @@ CONFIG_PARTITION_TABLE_MD5=y
|
|||
#
|
||||
# OpenTherm Configuration
|
||||
#
|
||||
CONFIG_OT_IN_PIN=21
|
||||
CONFIG_OT_OUT_PIN=22
|
||||
CONFIG_OT_IN_PIN=17
|
||||
CONFIG_OT_OUT_PIN=16
|
||||
# end of OpenTherm Configuration
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue