52 #include "sdkconfig.h"
55 #ifdef CONFIG_ESP_ENABLE_WIFI
56 #ifdef CONFIG_ESP_ENABLE_WIFI_STA
59 #ifdef CONFIG_ESP_ENABLE_WIFI_SOFTAP
71 volatile float goal = CONFIG_INITIAL_GOAL_TEMP;
72 volatile float temp = 0.0f;
74 volatile float over = 0.5f;
84 static const char *
TAG =
"esp32-warm-water";
90 sprintf(line,
" goal: %0.1f",
goal);
91 position = strlen(line);
92 sprintf(line,
" goal: %0.1f C",
goal);
95 sprintf(line,
" %1.1f %1.1f ",
under,
over);
99 sprintf(line,
" temp: %0.3f C",
temp);
101 sprintf(line,
" temp: %0.3f",
goal);
102 position = strlen(line);
107 position = strlen(
" mode: ");
114 gpio_set_level(CONFIG_RELAY_ONE_PIN, 0);
115 gpio_set_level(CONFIG_RELAY_TWO_PIN, 0);
116 ESP_LOGI(
TAG,
"relay on: setting to %d", 0);
121 gpio_set_level(CONFIG_RELAY_ONE_PIN, 1);
122 gpio_set_level(CONFIG_RELAY_TWO_PIN, 1);
123 ESP_LOGI(
TAG,
"relay off: setting to %d", 1);
141 ESP_LOGI(
TAG,
"%d: %.3f - %lld us", i, results[i], esp_timer_get_time());
158 led_off(CONFIG_STATUS_ONE_PIN);
165 led_on(CONFIG_STATUS_ONE_PIN);
193 #if defined(CONFIG_ESP_ENABLE_WIFI) && defined(CONFIG_ESP_ENABLE_WIFI_STA)
196 #if defined(CONFIG_ESP_ENABLE_WIFI) && defined(CONFIG_ESP_ENABLE_WIFI_SOFTAP)
void ds18b20_wrapped_deinit(void)
deinit the sensor cleans up and frees all of the devices and the onewire bus
void ds18b20_wrapped_capture(float *results, int size)
capture temps to results this function runs conversion on all the owb devices, waits for conversion t...
int ds18b20_wrapped_init(void)
init the sensor intitialises the onewire bus and finds and intialises ds18b20 sensors along the pin
definitions for wrapper component to help setup and interface with temp sensor
void gpio_output(gpio_num_t pin_number)
void check_relay(float average_temp)
SSD1306_t dev
device for oled
volatile float temp
current temp
int num_sensors
the number of sensors ds18b20 init has found (initially 0)
volatile float under
margin below goal temp at which to turn relay on
esp_timer_handle_t periodic_check_timer
variable to control the timer associated with running the temperature polling to check system
volatile float goal
goal temp for the system to aim for
volatile float over
margin above goal temp at which to turn relay off
void update_display(void)
void check_system_handler(void *arg)
volatile bool heating
whether or not the system should be outputing a signal to enable the relay (note: could be used to co...
defininitions for setting up, interacting with and sending commands to an ssd1306 driven screen via i...
void ssd1306_deinit(SSD1306_t *dev)
void ssd1306_wrapped_display_text(SSD1306_t *dev, int line, char *text)
void ssd1306_display_image(SSD1306_t *dev, int page, int seg, uint8_t *images, int width)
void ssd1306_init(SSD1306_t *dev)
void ssd1306_clear_screen(SSD1306_t *dev, bool invert)
defininitions for wrapper component which assists in setting up timers
void general_timer_deinit(esp_timer_handle_t timer)
void general_timer_init(esp_timer_handle_t timer, void(timer_callback)(void *arg), bool periodic, int period_in_seconds, char *timer_name)
defininitions for simple utility functions
void print_chip_info(void)
defininitions for webserver
esp_err_t start_file_server(const char *base_path)
defininitions for wrapper component to set up wifi in softap mode
void wifi_shared_deinit(void)
defininitions for wrapper component to set up wifi in station mode