11 return 0.9f * temp + 32.0f;
18 ESP_LOGW(TAG,
"Packet may be malformed");
23 ESP_LOGV(TAG,
"Created packet: %02X, %02X %02X", this->
packet_.
command, this->packet_.data[0], this->packet_.data[1]);
71 ESP_LOGVV(TAG,
"Received extra: %d bytes: %d %d %d %d", length, data[1], data[2], data[3], data[4]);
74 memcpy(((uint8_t *) (&this->
buf_)) + offset, data, length);
76 "Extra bytes: skip1=0x%08x, skip2=0x%04x, skip3=0x%02x; update phase=0x%02x, " 77 "flags=BedjetFlags <conn=%c, leds=%c, units=%c, mute=%c; packed=%02x>",
78 this->
buf_.
unused_1, this->buf_.unused_2, this->buf_.unused_3, this->buf_.update_phase,
79 this->buf_.flags.conn_test_passed ?
'1' :
'0', this->buf_.flags.leds_enabled ?
'1' :
'0',
80 this->buf_.flags.units_setup ?
'1' :
'0', this->buf_.flags.beeps_muted ?
'1' :
'0',
81 this->buf_.flags_packed);
83 ESP_LOGI(TAG,
"Could not determine where to append to, last offset=%d, max size=%u, new size would be %d", offset,
93 ESP_LOGV(TAG,
"Received: %d bytes: %d %d %d %d", length, data[1], data[2], data[3], data[4]);
99 memcpy(&this->
buf_, data, length);
103 if (this->
buf_.
mode < 7 && this->buf_.target_temp_step >= 38 && this->buf_.target_temp_step <= 86 &&
104 this->buf_.actual_temp_step > 1 && this->buf_.actual_temp_step <= 100 && this->buf_.ambient_temp_step > 1 &&
105 this->buf_.ambient_temp_step <= 100) {
112 ESP_LOGW(TAG,
"Received potentially invalid packet (len %d):", length);
117 "received DEBUG packet: set1=%01fF, set2=%01fF, air=%01fF; [7]=%d, [8]=%d, [9]=%d, [10]=%d, [11]=%d, " 120 data[9], data[10], data[11], data[12], data[length - 1]);
134 if (data ==
nullptr) {
159 return explicit_fields_changed;
uint8_t last_buffer_size_
BedjetPacketFormat packet_format
BedjetPacketFormat::PACKET_FORMAT_V3_HOME for BedJet V3 status packet format.
bool compare(const uint8_t *data, uint16_t length)
uint8_t fan_step
BedJet fan speed; value is in the 0-19 range, representing 5% increments (5%-100%): `5 + 5...
bool is_partial
1 indicates that this is a partial packet, and more data can be read directly from the characteristic...
BedjetPacket * get_set_target_temp_request(float temperature)
Returns a BedjetPacket that will set the device's target temperature.
uint8_t ambient_temp_step
Current ambient air temp.
The format of a BedJet V3 status packet.
BedjetMode mode
BedJet operating mode.
float bedjet_temp_to_c(uint8_t temp)
Converts a BedJet temp step into degrees Celsius.
BedjetPacket * clean_packet_()
Cleans up the packet before sending.
float bedjet_temp_to_f(const uint8_t temp)
Converts a BedJet temp step into degrees Fahrenheit.
void decode_extra(const uint8_t *data, uint16_t length)
Decodes the extra bytes that were received after being notified with a partial packet.
BedjetPacket * get_set_fan_speed_request(uint8_t fan_step)
Returns a BedjetPacket that will set the device's target fan speed.
BedjetPacket * get_button_request(BedjetButton button)
Returns a BedjetPacket that will initiate a BedjetButton press.
BedjetPacket * get_set_time_request(uint8_t hour, uint8_t minute)
Returns a BedjetPacket that will set the device's current time.
BedjetPacket * get_set_runtime_remaining_request(uint8_t hour, uint8_t minute)
Returns a BedjetPacket that will set the device's remaining runtime.
uint8_t target_temp_step
Target temp that the BedJet will try to heat to. See actual_temp_step.
Implementation of SPI Controller mode.
uint8_t fan_step
BedJet fan speed; value is in the 0-19 range, representing 5% increments (5%-100%): `5 + 5...
BedjetStatusPacket * status_packet_
bool decode_notify(const uint8_t *data, uint16_t length)
Decodes the incoming status packet received on the BEDJET_STATUS_UUID.