8float ftoc(
float f) {
return (f - 32.0) * (5.0f / 9.0f); }
10float ctof(
float c) {
return (c * 9.0f / 5.0f) + 32.0; }
15 ESP_LOGV(
"anova",
"SendPkt: %s\n", this->
packet_.
data);
21 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_READ_DEVICE_STATUS);
27 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_READ_TARGET_TEMP);
33 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_READ_CURRENT_TEMP);
39 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_READ_UNIT);
45 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_READ_DATA);
59 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data), CMD_SET_TEMP_UNIT, unit);
65 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_START);
71 snprintf((
char *) this->
packet_.
data,
sizeof(this->packet_.data),
"%s", CMD_STOP);
77 memset(buf, 0,
sizeof(buf));
78 strncpy(buf, (
char *) data, std::min<uint16_t>(
length,
sizeof(buf) - 1));
82 if (!strncmp(buf,
"stopped", 7)) {
86 if (!strncmp(buf,
"running", 7)) {
93 if (!strncmp(buf,
"start", 5)) {
100 if (!strncmp(buf,
"stop", 4)) {
123 this->
unit_ = buf[0];
AnovaPacket * get_read_current_temp_request()
AnovaPacket * get_set_target_temp_request(float temperature)
void decode(const uint8_t *data, uint16_t length)
AnovaPacket * get_set_unit_request(char unit)
AnovaPacket * get_read_device_status_request()
AnovaPacket * get_start_request()
AnovaPacket * clean_packet_()
AnovaPacket * get_read_target_temp_request()
CurrentQuery current_query_
AnovaPacket * get_stop_request()
AnovaPacket * get_read_data_request()
AnovaPacket * get_read_unit_request()
@ READ_TARGET_TEMPERATURE
@ READ_CURRENT_TEMPERATURE
Providing packet encoding functions for exchanging data with a remote host.
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
std::string str_until(const char *str, char ch)
Extract the part of the string until either the first occurrence of the specified character,...