7 static const char *
const TAG =
"pipsolar";
9 void Pipsolar::setup() {
21 void Pipsolar::loop() {
42 ESP_LOGD(TAG,
"response length for command OK");
46 ESP_LOGD(TAG,
"command successful");
48 ESP_LOGD(TAG,
"command not successful");
61 ESP_LOGD(TAG,
"response length for command %s not OK: with length %zu",
73 if (this->grid_rating_voltage_) {
74 this->grid_rating_voltage_->publish_state(value_grid_rating_voltage_);
76 if (this->grid_rating_current_) {
77 this->grid_rating_current_->publish_state(value_grid_rating_current_);
79 if (this->ac_output_rating_voltage_) {
80 this->ac_output_rating_voltage_->publish_state(value_ac_output_rating_voltage_);
82 if (this->ac_output_rating_frequency_) {
83 this->ac_output_rating_frequency_->publish_state(value_ac_output_rating_frequency_);
85 if (this->ac_output_rating_current_) {
86 this->ac_output_rating_current_->publish_state(value_ac_output_rating_current_);
88 if (this->ac_output_rating_apparent_power_) {
89 this->ac_output_rating_apparent_power_->publish_state(value_ac_output_rating_apparent_power_);
91 if (this->ac_output_rating_active_power_) {
92 this->ac_output_rating_active_power_->publish_state(value_ac_output_rating_active_power_);
94 if (this->battery_rating_voltage_) {
95 this->battery_rating_voltage_->publish_state(value_battery_rating_voltage_);
97 if (this->battery_recharge_voltage_) {
98 this->battery_recharge_voltage_->publish_state(value_battery_recharge_voltage_);
100 if (this->battery_under_voltage_) {
101 this->battery_under_voltage_->publish_state(value_battery_under_voltage_);
103 if (this->battery_bulk_voltage_) {
104 this->battery_bulk_voltage_->publish_state(value_battery_bulk_voltage_);
106 if (this->battery_float_voltage_) {
107 this->battery_float_voltage_->publish_state(value_battery_float_voltage_);
109 if (this->battery_type_) {
110 this->battery_type_->publish_state(value_battery_type_);
112 if (this->current_max_ac_charging_current_) {
113 this->current_max_ac_charging_current_->publish_state(value_current_max_ac_charging_current_);
115 if (this->current_max_charging_current_) {
116 this->current_max_charging_current_->publish_state(value_current_max_charging_current_);
118 if (this->input_voltage_range_) {
119 this->input_voltage_range_->publish_state(value_input_voltage_range_);
122 if (this->input_voltage_range_switch_) {
123 this->input_voltage_range_switch_->publish_state(value_input_voltage_range_ == 1);
125 if (this->output_source_priority_) {
126 this->output_source_priority_->publish_state(value_output_source_priority_);
129 if (this->output_source_priority_utility_switch_) {
130 this->output_source_priority_utility_switch_->publish_state(value_output_source_priority_ == 0);
132 if (this->output_source_priority_solar_switch_) {
133 this->output_source_priority_solar_switch_->publish_state(value_output_source_priority_ == 1);
135 if (this->output_source_priority_battery_switch_) {
136 this->output_source_priority_battery_switch_->publish_state(value_output_source_priority_ == 2);
138 if (this->charger_source_priority_) {
139 this->charger_source_priority_->publish_state(value_charger_source_priority_);
141 if (this->parallel_max_num_) {
142 this->parallel_max_num_->publish_state(value_parallel_max_num_);
144 if (this->machine_type_) {
145 this->machine_type_->publish_state(value_machine_type_);
147 if (this->topology_) {
148 this->topology_->publish_state(value_topology_);
150 if (this->output_mode_) {
151 this->output_mode_->publish_state(value_output_mode_);
153 if (this->battery_redischarge_voltage_) {
154 this->battery_redischarge_voltage_->publish_state(value_battery_redischarge_voltage_);
156 if (this->pv_ok_condition_for_parallel_) {
157 this->pv_ok_condition_for_parallel_->publish_state(value_pv_ok_condition_for_parallel_);
160 if (this->pv_ok_condition_for_parallel_switch_) {
161 this->pv_ok_condition_for_parallel_switch_->publish_state(value_pv_ok_condition_for_parallel_ == 1);
163 if (this->pv_power_balance_) {
164 this->pv_power_balance_->publish_state(value_pv_power_balance_ == 1);
167 if (this->pv_power_balance_switch_) {
168 this->pv_power_balance_switch_->publish_state(value_pv_power_balance_ == 1);
173 if (this->grid_voltage_) {
174 this->grid_voltage_->publish_state(value_grid_voltage_);
176 if (this->grid_frequency_) {
177 this->grid_frequency_->publish_state(value_grid_frequency_);
179 if (this->ac_output_voltage_) {
180 this->ac_output_voltage_->publish_state(value_ac_output_voltage_);
182 if (this->ac_output_frequency_) {
183 this->ac_output_frequency_->publish_state(value_ac_output_frequency_);
185 if (this->ac_output_apparent_power_) {
186 this->ac_output_apparent_power_->publish_state(value_ac_output_apparent_power_);
188 if (this->ac_output_active_power_) {
189 this->ac_output_active_power_->publish_state(value_ac_output_active_power_);
191 if (this->output_load_percent_) {
192 this->output_load_percent_->publish_state(value_output_load_percent_);
194 if (this->bus_voltage_) {
195 this->bus_voltage_->publish_state(value_bus_voltage_);
197 if (this->battery_voltage_) {
198 this->battery_voltage_->publish_state(value_battery_voltage_);
200 if (this->battery_charging_current_) {
201 this->battery_charging_current_->publish_state(value_battery_charging_current_);
203 if (this->battery_capacity_percent_) {
204 this->battery_capacity_percent_->publish_state(value_battery_capacity_percent_);
206 if (this->inverter_heat_sink_temperature_) {
207 this->inverter_heat_sink_temperature_->publish_state(value_inverter_heat_sink_temperature_);
209 if (this->pv_input_current_for_battery_) {
210 this->pv_input_current_for_battery_->publish_state(value_pv_input_current_for_battery_);
212 if (this->pv_input_voltage_) {
213 this->pv_input_voltage_->publish_state(value_pv_input_voltage_);
215 if (this->battery_voltage_scc_) {
216 this->battery_voltage_scc_->publish_state(value_battery_voltage_scc_);
218 if (this->battery_discharge_current_) {
219 this->battery_discharge_current_->publish_state(value_battery_discharge_current_);
221 if (this->add_sbu_priority_version_) {
222 this->add_sbu_priority_version_->publish_state(value_add_sbu_priority_version_);
224 if (this->configuration_status_) {
225 this->configuration_status_->publish_state(value_configuration_status_);
227 if (this->scc_firmware_version_) {
228 this->scc_firmware_version_->publish_state(value_scc_firmware_version_);
230 if (this->load_status_) {
231 this->load_status_->publish_state(value_load_status_);
233 if (this->battery_voltage_to_steady_while_charging_) {
234 this->battery_voltage_to_steady_while_charging_->publish_state(
235 value_battery_voltage_to_steady_while_charging_);
237 if (this->charging_status_) {
238 this->charging_status_->publish_state(value_charging_status_);
240 if (this->scc_charging_status_) {
241 this->scc_charging_status_->publish_state(value_scc_charging_status_);
243 if (this->ac_charging_status_) {
244 this->ac_charging_status_->publish_state(value_ac_charging_status_);
246 if (this->battery_voltage_offset_for_fans_on_) {
247 this->battery_voltage_offset_for_fans_on_->publish_state(value_battery_voltage_offset_for_fans_on_ / 10.0f);
249 if (this->eeprom_version_) {
250 this->eeprom_version_->publish_state(value_eeprom_version_);
252 if (this->pv_charging_power_) {
253 this->pv_charging_power_->publish_state(value_pv_charging_power_);
255 if (this->charging_to_floating_mode_) {
256 this->charging_to_floating_mode_->publish_state(value_charging_to_floating_mode_);
258 if (this->switch_on_) {
259 this->switch_on_->publish_state(value_switch_on_);
261 if (this->dustproof_installed_) {
262 this->dustproof_installed_->publish_state(value_dustproof_installed_);
267 if (this->device_mode_) {
268 mode = value_device_mode_;
269 this->device_mode_->publish_state(mode);
274 if (this->silence_buzzer_open_buzzer_) {
275 this->silence_buzzer_open_buzzer_->publish_state(value_silence_buzzer_open_buzzer_);
277 if (this->overload_bypass_function_) {
278 this->overload_bypass_function_->publish_state(value_overload_bypass_function_);
280 if (this->lcd_escape_to_default_) {
281 this->lcd_escape_to_default_->publish_state(value_lcd_escape_to_default_);
283 if (this->overload_restart_function_) {
284 this->overload_restart_function_->publish_state(value_overload_restart_function_);
286 if (this->over_temperature_restart_function_) {
287 this->over_temperature_restart_function_->publish_state(value_over_temperature_restart_function_);
289 if (this->backlight_on_) {
290 this->backlight_on_->publish_state(value_backlight_on_);
292 if (this->alarm_on_when_primary_source_interrupt_) {
293 this->alarm_on_when_primary_source_interrupt_->publish_state(value_alarm_on_when_primary_source_interrupt_);
295 if (this->fault_code_record_) {
296 this->fault_code_record_->publish_state(value_fault_code_record_);
298 if (this->power_saving_) {
299 this->power_saving_->publish_state(value_power_saving_);
304 if (this->warnings_present_) {
305 this->warnings_present_->publish_state(value_warnings_present_);
307 if (this->faults_present_) {
308 this->faults_present_->publish_state(value_faults_present_);
310 if (this->warning_power_loss_) {
311 this->warning_power_loss_->publish_state(value_warning_power_loss_);
313 if (this->fault_inverter_fault_) {
314 this->fault_inverter_fault_->publish_state(value_fault_inverter_fault_);
316 if (this->fault_bus_over_) {
317 this->fault_bus_over_->publish_state(value_fault_bus_over_);
319 if (this->fault_bus_under_) {
320 this->fault_bus_under_->publish_state(value_fault_bus_under_);
322 if (this->fault_bus_soft_fail_) {
323 this->fault_bus_soft_fail_->publish_state(value_fault_bus_soft_fail_);
325 if (this->warning_line_fail_) {
326 this->warning_line_fail_->publish_state(value_warning_line_fail_);
328 if (this->fault_opvshort_) {
329 this->fault_opvshort_->publish_state(value_fault_opvshort_);
331 if (this->fault_inverter_voltage_too_low_) {
332 this->fault_inverter_voltage_too_low_->publish_state(value_fault_inverter_voltage_too_low_);
334 if (this->fault_inverter_voltage_too_high_) {
335 this->fault_inverter_voltage_too_high_->publish_state(value_fault_inverter_voltage_too_high_);
337 if (this->warning_over_temperature_) {
338 this->warning_over_temperature_->publish_state(value_warning_over_temperature_);
340 if (this->warning_fan_lock_) {
341 this->warning_fan_lock_->publish_state(value_warning_fan_lock_);
343 if (this->warning_battery_voltage_high_) {
344 this->warning_battery_voltage_high_->publish_state(value_warning_battery_voltage_high_);
346 if (this->warning_battery_low_alarm_) {
347 this->warning_battery_low_alarm_->publish_state(value_warning_battery_low_alarm_);
349 if (this->warning_battery_under_shutdown_) {
350 this->warning_battery_under_shutdown_->publish_state(value_warning_battery_under_shutdown_);
352 if (this->warning_battery_derating_) {
353 this->warning_battery_derating_->publish_state(value_warning_battery_derating_);
355 if (this->warning_over_load_) {
356 this->warning_over_load_->publish_state(value_warning_over_load_);
358 if (this->warning_eeprom_failed_) {
359 this->warning_eeprom_failed_->publish_state(value_warning_eeprom_failed_);
361 if (this->fault_inverter_over_current_) {
362 this->fault_inverter_over_current_->publish_state(value_fault_inverter_over_current_);
364 if (this->fault_inverter_soft_failed_) {
365 this->fault_inverter_soft_failed_->publish_state(value_fault_inverter_soft_failed_);
367 if (this->fault_self_test_failed_) {
368 this->fault_self_test_failed_->publish_state(value_fault_self_test_failed_);
370 if (this->fault_op_dc_voltage_over_) {
371 this->fault_op_dc_voltage_over_->publish_state(value_fault_op_dc_voltage_over_);
373 if (this->fault_battery_open_) {
374 this->fault_battery_open_->publish_state(value_fault_battery_open_);
376 if (this->fault_current_sensor_failed_) {
377 this->fault_current_sensor_failed_->publish_state(value_fault_current_sensor_failed_);
379 if (this->fault_battery_short_) {
380 this->fault_battery_short_->publish_state(value_fault_battery_short_);
382 if (this->warning_power_limit_) {
383 this->warning_power_limit_->publish_state(value_warning_power_limit_);
385 if (this->warning_pv_voltage_high_) {
386 this->warning_pv_voltage_high_->publish_state(value_warning_pv_voltage_high_);
388 if (this->fault_mppt_overload_) {
389 this->fault_mppt_overload_->publish_state(value_fault_mppt_overload_);
391 if (this->warning_mppt_overload_) {
392 this->warning_mppt_overload_->publish_state(value_warning_mppt_overload_);
394 if (this->warning_battery_too_low_to_charge_) {
395 this->warning_battery_too_low_to_charge_->publish_state(value_warning_battery_too_low_to_charge_);
397 if (this->fault_dc_dc_over_current_) {
398 this->fault_dc_dc_over_current_->publish_state(value_fault_dc_dc_over_current_);
400 if (this->fault_code_) {
401 this->fault_code_->publish_state(value_fault_code_);
403 if (this->warnung_low_pv_energy_) {
404 this->warnung_low_pv_energy_->publish_state(value_warnung_low_pv_energy_);
406 if (this->warning_high_ac_input_during_bus_soft_start_) {
407 this->warning_high_ac_input_during_bus_soft_start_->publish_state(
408 value_warning_high_ac_input_during_bus_soft_start_);
410 if (this->warning_battery_equalization_) {
411 this->warning_battery_equalization_->publish_state(value_warning_battery_equalization_);
429 ESP_LOGD(TAG,
"Decode QPIRI");
430 sscanf(tmp,
"(%f %f %f %f %f %d %d %f %f %f %f %f %d %d %d %d %d %d %d %d %d %d %f %d %d",
431 &value_grid_rating_voltage_, &value_grid_rating_current_, &value_ac_output_rating_voltage_,
432 &value_ac_output_rating_frequency_, &value_ac_output_rating_current_,
433 &value_ac_output_rating_apparent_power_, &value_ac_output_rating_active_power_,
434 &value_battery_rating_voltage_, &value_battery_recharge_voltage_,
435 &value_battery_under_voltage_, &value_battery_bulk_voltage_, &value_battery_float_voltage_,
436 &value_battery_type_, &value_current_max_ac_charging_current_,
437 &value_current_max_charging_current_, &value_input_voltage_range_,
438 &value_output_source_priority_, &value_charger_source_priority_, &value_parallel_max_num_,
439 &value_machine_type_, &value_topology_, &value_output_mode_,
440 &value_battery_redischarge_voltage_, &value_pv_ok_condition_for_parallel_,
441 &value_pv_power_balance_);
442 if (this->last_qpiri_) {
443 this->last_qpiri_->publish_state(tmp);
448 ESP_LOGD(TAG,
"Decode QPIGS");
451 "(%f %f %f %f %d %d %d %d %f %d %d %d %d %f %f %d %1d%1d%1d%1d%1d%1d%1d%1d %d %d %d %1d%1d%1d",
452 &value_grid_voltage_, &value_grid_frequency_, &value_ac_output_voltage_,
453 &value_ac_output_frequency_,
454 &value_ac_output_apparent_power_, &value_ac_output_active_power_, &value_output_load_percent_,
455 &value_bus_voltage_, &value_battery_voltage_, &value_battery_charging_current_,
456 &value_battery_capacity_percent_, &value_inverter_heat_sink_temperature_,
457 &value_pv_input_current_for_battery_, &value_pv_input_voltage_, &value_battery_voltage_scc_,
458 &value_battery_discharge_current_, &value_add_sbu_priority_version_,
459 &value_configuration_status_, &value_scc_firmware_version_, &value_load_status_,
460 &value_battery_voltage_to_steady_while_charging_, &value_charging_status_,
461 &value_scc_charging_status_, &value_ac_charging_status_,
462 &value_battery_voltage_offset_for_fans_on_, &value_eeprom_version_, &value_pv_charging_power_,
463 &value_charging_to_floating_mode_, &value_switch_on_,
464 &value_dustproof_installed_);
465 if (this->last_qpigs_) {
466 this->last_qpigs_->publish_state(tmp);
471 ESP_LOGD(TAG,
"Decode QMOD");
473 if (this->last_qmod_) {
474 this->last_qmod_->publish_state(tmp);
479 ESP_LOGD(TAG,
"Decode QFLAG");
482 for (
size_t i = 1; i < strlen(tmp); i++) {
491 this->value_silence_buzzer_open_buzzer_ = enabled;
494 this->value_overload_bypass_function_ = enabled;
497 this->value_lcd_escape_to_default_ = enabled;
500 this->value_overload_restart_function_ = enabled;
503 this->value_over_temperature_restart_function_ = enabled;
506 this->value_backlight_on_ = enabled;
509 this->value_alarm_on_when_primary_source_interrupt_ = enabled;
512 this->value_fault_code_record_ = enabled;
515 this->value_power_saving_ = enabled;
519 if (this->last_qflag_) {
520 this->last_qflag_->publish_state(tmp);
525 ESP_LOGD(TAG,
"Decode QPIWS");
528 this->value_warnings_present_ =
false;
529 this->value_faults_present_ =
true;
531 for (
size_t i = 1; i < strlen(tmp); i++) {
532 enabled = tmp[i] ==
'1';
535 this->value_warning_power_loss_ = enabled;
536 this->value_warnings_present_ += enabled;
539 this->value_fault_inverter_fault_ = enabled;
540 this->value_faults_present_ += enabled;
543 this->value_fault_bus_over_ = enabled;
544 this->value_faults_present_ += enabled;
547 this->value_fault_bus_under_ = enabled;
548 this->value_faults_present_ += enabled;
551 this->value_fault_bus_soft_fail_ = enabled;
552 this->value_faults_present_ += enabled;
555 this->value_warning_line_fail_ = enabled;
556 this->value_warnings_present_ += enabled;
559 this->value_fault_opvshort_ = enabled;
560 this->value_faults_present_ += enabled;
563 this->value_fault_inverter_voltage_too_low_ = enabled;
564 this->value_faults_present_ += enabled;
567 this->value_fault_inverter_voltage_too_high_ = enabled;
568 this->value_faults_present_ += enabled;
571 this->value_warning_over_temperature_ = enabled;
572 this->value_warnings_present_ += enabled;
575 this->value_warning_fan_lock_ = enabled;
576 this->value_warnings_present_ += enabled;
579 this->value_warning_battery_voltage_high_ = enabled;
580 this->value_warnings_present_ += enabled;
583 this->value_warning_battery_low_alarm_ = enabled;
584 this->value_warnings_present_ += enabled;
587 this->value_warning_battery_under_shutdown_ = enabled;
588 this->value_warnings_present_ += enabled;
591 this->value_warning_battery_derating_ = enabled;
592 this->value_warnings_present_ += enabled;
595 this->value_warning_over_load_ = enabled;
596 this->value_warnings_present_ += enabled;
599 this->value_warning_eeprom_failed_ = enabled;
600 this->value_warnings_present_ += enabled;
603 this->value_fault_inverter_over_current_ = enabled;
604 this->value_faults_present_ += enabled;
607 this->value_fault_inverter_soft_failed_ = enabled;
608 this->value_faults_present_ += enabled;
611 this->value_fault_self_test_failed_ = enabled;
612 this->value_faults_present_ += enabled;
615 this->value_fault_op_dc_voltage_over_ = enabled;
616 this->value_faults_present_ += enabled;
619 this->value_fault_battery_open_ = enabled;
620 this->value_faults_present_ += enabled;
623 this->value_fault_current_sensor_failed_ = enabled;
624 this->value_faults_present_ += enabled;
627 this->value_fault_battery_short_ = enabled;
628 this->value_faults_present_ += enabled;
631 this->value_warning_power_limit_ = enabled;
632 this->value_warnings_present_ += enabled;
635 this->value_warning_pv_voltage_high_ = enabled;
636 this->value_warnings_present_ += enabled;
639 this->value_fault_mppt_overload_ = enabled;
640 this->value_faults_present_ += enabled;
643 this->value_warning_mppt_overload_ = enabled;
644 this->value_warnings_present_ += enabled;
647 this->value_warning_battery_too_low_to_charge_ = enabled;
648 this->value_warnings_present_ += enabled;
651 this->value_fault_dc_dc_over_current_ = enabled;
652 this->value_faults_present_ += enabled;
657 this->value_fault_code_ = parse_number<int>(fc).value_or(0);
660 this->value_warnung_low_pv_energy_ = enabled;
661 this->value_warnings_present_ += enabled;
664 this->value_warning_high_ac_input_during_bus_soft_start_ = enabled;
665 this->value_warnings_present_ += enabled;
668 this->value_warning_battery_equalization_ = enabled;
669 this->value_warnings_present_ += enabled;
673 if (this->last_qpiws_) {
674 this->last_qpiws_->publish_state(tmp);
679 ESP_LOGD(TAG,
"Decode QT");
680 if (this->last_qt_) {
681 this->last_qt_->publish_state(tmp);
686 ESP_LOGD(TAG,
"Decode QMN");
687 if (this->last_qmn_) {
688 this->last_qmn_->publish_state(tmp);
744 ESP_LOGD(TAG,
"timeout command from queue: %s", command);
772 ESP_LOGD(TAG,
"checking crc on incoming message");
775 ESP_LOGD(TAG,
"CRC OK");
781 ESP_LOGD(TAG,
"CRC NOK expected: %X %X but got: %X %X", ((uint8_t)((crc16) >> 8)), ((uint8_t)((crc16) &0xff)),
791 uint8_t byte_command[16];
793 for (uint8_t i = 0; i < length; i++) {
803 this->
write(((uint8_t)((crc16) >> 8)));
804 this->
write(((uint8_t)((crc16) &0xff)));
807 ESP_LOGD(TAG,
"Sending command from queue: %s with length %d", command, length);
832 this->
write(((uint8_t)((crc16) >> 8)));
833 this->
write(((uint8_t)((crc16) &0xff)));
836 ESP_LOGD(TAG,
"Sending polling command : %s with length %d",
844 uint8_t testposition = (next_position + i) % COMMAND_QUEUE_LENGTH;
847 ESP_LOGD(TAG,
"Command queued successfully: %s with length %u at position %d", command,
852 ESP_LOGD(TAG,
"Command queue full dropping command: %s", command);
855 void Pipsolar::switch_command(
const std::string &command) {
856 ESP_LOGD(TAG,
"got command: %s", command.c_str());
859 void Pipsolar::dump_config() {
860 ESP_LOGCONFIG(TAG,
"Pipsolar:");
861 ESP_LOGCONFIG(TAG,
"used commands:");
863 if (used_polling_command.length != 0) {
864 ESP_LOGCONFIG(TAG,
"%s", used_polling_command.command);
868 void Pipsolar::update() {}
872 if (used_polling_command.length == strlen(command)) {
873 uint8_t
len = strlen(command);
874 if (memcmp(used_polling_command.command, command, len) == 0) {
878 if (used_polling_command.length == 0) {
879 size_t length = strlen(command) + 1;
880 const char *beg = command;
881 const char *end = command + length;
882 used_polling_command.command =
new uint8_t[length];
884 for (; beg != end; ++beg, ++i) {
885 used_polling_command.command[i] = (uint8_t)(*beg);
887 used_polling_command.errors = 0;
888 used_polling_command.identifier = polling_command;
889 used_polling_command.length = length - 1;
903 uint16_t crc_ta[16] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
904 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef};
910 da = ((uint8_t)(crc >> 8)) >> 4;
912 crc ^= crc_ta[da ^ (*ptr >> 4)];
913 da = ((uint8_t)(crc >> 8)) >> 4;
915 crc ^= crc_ta[da ^ (*ptr & 0x0f)];
920 b_crc_hign = (uint8_t)(crc >> 8);
922 if (b_crc_low == 0x28 || b_crc_low == 0x0d || b_crc_low == 0x0a)
924 if (b_crc_hign == 0x28 || b_crc_hign == 0x0d || b_crc_hign == 0x0a)
927 crc = ((uint16_t) b_crc_hign) << 8;
void write_str(const char *str)
uint32_t update_interval_
std::string command_queue_[COMMAND_QUEUE_LENGTH]
static const size_t COMMAND_QUEUE_LENGTH
uint8_t check_incoming_crc_()
void write_array(const uint8_t *data, size_t len)
uint8_t check_incoming_length_(uint8_t length)
static const size_t COMMAND_TIMEOUT
uint8_t read_buffer_[PIPSOLAR_READ_BUFFER_LENGTH]
void add_polling_command_(const char *command, ENUMPollingCommand polling_command)
uint32_t IRAM_ATTR HOT millis()
uint16_t crc16(const uint8_t *data, uint8_t len)
Calculate a CRC-16 checksum of data with size len.
uint32_t command_start_millis_
bool read_byte(uint8_t *data)
void queue_command_(const char *command, uint8_t length)
BedjetMode mode
BedJet operating mode.
static const size_t PIPSOLAR_READ_BUFFER_LENGTH
PollingCommand used_polling_commands_[15]
uint8_t last_polling_command_
uint8_t send_next_command_()
uint8_t command_queue_position_
void empty_uart_buffer_()
uint16_t cal_crc_half_(uint8_t *msg, uint8_t len)
size_t write(uint8_t data)