11static constexpr uint8_t START_CHARACTER_1 = 0x42;
12static constexpr uint8_t START_CHARACTER_2 = 0x4D;
14static constexpr uint8_t MAX_FRAME_SIZE = 40;
48 void setup()
override;
57 SUB_SENSOR(pm_1_0_std)
58 SUB_SENSOR(pm_2_5_std)
59 SUB_SENSOR(pm_10_0_std)
67 SUB_SENSOR(pm_particles_03um)
68 SUB_SENSOR(pm_particles_05um)
69 SUB_SENSOR(pm_particles_10um)
70 SUB_SENSOR(pm_particles_25um)
71 SUB_SENSOR(pm_particles_50um)
72 SUB_SENSOR(pm_particles_100um)
75 SUB_SENSOR(formaldehyde)
82 bool check_frame_(
const uint8_t *frame,
size_t total_size);
Collects binary frames that give their own length, of up to N bytes, in one or more FrameFormats; the...
void set_update_interval(uint32_t update_interval)
void dump_config() override
PMSX003Component()=default
uint32_t last_transmission_
LengthFrameReader< MAX_FRAME_SIZE, PmsFrame > reader_
void send_command_(Command cmd, uint16_t data)
uint32_t update_interval_
bool check_payload_length_(uint16_t payload_length)
SUB_SENSOR(pm_1_0_std) SUB_SENSOR(pm_2_5_std) SUB_SENSOR(pm_10_0_std) SUB_SENSOR(pm_1_0) SUB_SENSOR(pm_2_5) SUB_SENSOR(pm_10_0) SUB_SENSOR(pm_particles_03um) SUB_SENSOR(pm_particles_05um) SUB_SENSOR(pm_particles_10um) SUB_SENSOR(pm_particles_25um) SUB_SENSOR(pm_particles_50um) SUB_SENSOR(pm_particles_100um) SUB_SENSOR(formaldehyde) SUB_SENSOR(temperature) SUB_SENSOR(humidity) protected void parse_data_(const uint8_t *frame)
void warn_too_long(size_t len)
The wrong-type warning, for a frame longer than any supported type sends.
PayloadLengthU16BE< LengthField{.offset=2}> PayloadLength
offset: where the length field starts, counted from the first header byte.
FrameFormat option: a frame longer than MAX calls WARN(length) and is skipped; a replay can warn agai...