21 ESP_LOGCONFIG(TAG,
"MicroNova:");
27 mv_sensor->dump_config();
28 ESP_LOGCONFIG(TAG,
" sensor location:%02X, address:%02X", mv_sensor->get_memory_location(),
29 mv_sensor->get_memory_address());
34 ESP_LOGD(TAG,
"Schedule sensor update");
36 mv_listener->set_needs_update(
true);
55 if (mv_listener->get_needs_update()) {
56 mv_listener->set_needs_update(
false);
66 uint8_t write_data[2] = {0, 0};
74 ESP_LOGW(TAG,
"Reading excess byte 0x%02X", trash_rx);
77 write_data[0] = location;
79 ESP_LOGV(TAG,
"Request from stove [%02X,%02X]", write_data[0], write_data[1]);
92 ESP_LOGE(TAG,
"Reply is pending, skipping read request");
97 uint8_t reply_data[2] = {0, 0};
104 ESP_LOGV(TAG,
"Reply from stove [%02X,%02X]", reply_data[0], reply_data[1]);
109 if (reply_data[0] != checksum) {
110 ESP_LOGE(TAG,
"Checksum missmatch! From [0x%02X:0x%02X] received [0x%02X,0x%02X]. Expected 0x%02X, got 0x%02X",
112 reply_data[1], checksum, reply_data[0]);
115 return ((
int) reply_data[1]);
119 uint8_t write_data[4] = {0, 0, 0, 0};
123 write_data[0] = location;
125 write_data[2] = data;
127 checksum = ((uint16_t) write_data[0] + (uint16_t) write_data[1] + (uint16_t) write_data[2]) & 0xFF;
130 ESP_LOGV(TAG,
"Write 4 bytes [%02X,%02X,%02X,%02X]", write_data[0], write_data[1], write_data[2], write_data[3]);
143 ESP_LOGE(TAG,
"Reply is pending, skipping write");
virtual void digital_write(bool value)=0
optional< std::array< uint8_t, N > > read_array()
void write_array(const uint8_t *data, size_t len)
void dump_config() override
virtual void pin_mode(gpio::Flags flags)=0
void write_address(uint8_t location, uint8_t address, uint8_t data)
MicroNovaSerialTransmission current_transmission_
uint32_t IRAM_ATTR HOT millis()
uint32_t request_transmission_time
std::vector< MicroNovaSensorListener * > micronova_listeners_
Mutex reply_pending_mutex_
MicroNovaSensorListener * initiating_listener
bool read_byte(uint8_t *data)
virtual void request_value_from_stove()=0
void request_address(uint8_t location, uint8_t address, MicroNovaSensorListener *listener)
Implementation of SPI Controller mode.
virtual void process_value_from_stove(int value_from_stove)=0