8 float ftoc(
float f) {
return (f - 32.0) * (5.0f / 9.0f); }
10 float ctof(
float c) {
return (c * 9.0f / 5.0f) + 32.0; }
15 ESP_LOGV(
"anova",
"SendPkt: %s\n", this->
packet_.
data);
21 sprintf((
char *) this->
packet_.
data,
"%s", CMD_READ_DEVICE_STATUS);
27 sprintf((
char *) this->
packet_.
data,
"%s", CMD_READ_TARGET_TEMP);
33 sprintf((
char *) this->
packet_.
data,
"%s", CMD_READ_CURRENT_TEMP);
39 sprintf((
char *) this->
packet_.
data,
"%s", CMD_READ_UNIT);
45 sprintf((
char *) this->
packet_.
data,
"%s", CMD_READ_DATA);
52 temperature =
ctof(temperature);
53 sprintf((
char *) this->
packet_.
data, CMD_SET_TARGET_TEMP, temperature);
59 sprintf((
char *) this->
packet_.
data, CMD_SET_TEMP_UNIT, unit);
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_data_request()
std::string str_until(const char *str, char ch)
Extract the part of the string until either the first occurrence of the specified character...
CurrentQuery current_query_
AnovaPacket * get_read_current_temp_request()
AnovaPacket * get_set_target_temp_request(float temperature)
AnovaPacket * get_start_request()
AnovaPacket * get_stop_request()
AnovaPacket * get_read_unit_request()
AnovaPacket * get_set_unit_request(char unit)
AnovaPacket * get_read_device_status_request()
AnovaPacket * get_read_target_temp_request()
Implementation of SPI Controller mode.
AnovaPacket * clean_packet_()
void decode(const uint8_t *data, uint16_t length)