ESPHome 2025.5.0
Loading...
Searching...
No Matches
m5stack_8angle_sensor.cpp
Go to the documentation of this file.
2
3namespace esphome {
4namespace m5stack_8angle {
5
7 if (this->parent_ != nullptr) {
8 int32_t raw_pos = this->parent_->read_knob_pos_raw(this->channel_, this->bits_);
9 if (raw_pos == -1) {
10 this->status_set_warning("Could not read knob position from M5Stack 8Angle.");
11 return;
12 }
13 if (this->raw_) {
14 this->publish_state(raw_pos);
15 } else {
16 float knob_pos = (float) raw_pos / ((1 << this->bits_) - 1);
17 this->publish_state(knob_pos);
18 }
20 };
21}
22
23} // namespace m5stack_8angle
24} // namespace esphome
void status_set_warning(const char *message="unspecified")
void status_clear_warning()
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:39
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7