1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-10 23:32:23 +01:00

add initial test of dynamic lamp component

This commit is contained in:
Oliver Kleinecke
2025-02-14 11:43:47 +01:00
parent bbdc9c52ba
commit c841ae4fcc
4 changed files with 178 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
#include "esphome/core/log.h"
#include "dynamic_lamp.h"
namespace esphome {
namespace dynamic_lamp {
static const char *TAG = "dynamic_lamp";
void DynamicLamp::setup() {
uint8_t i = 0;
bool valid = true;
this->save_mode_ = SAVE_MODE_NONE; //Currently only none & fram supported
if(this->save_mode_ == 0) {
for (i=0; i < 16; i++) {
this->active_lamps_[i].active = false;
}
} else {
while(i < 16) {
this->restore_lamp_values_(i);
}
}
}
void DynamicLamp::loop() {
}
void DynamicLamp::dump_config(){
ESP_LOGCONFIG(TAG, "Dynamic Lamp feature loaded");
switch(this->save_mode_) {
case SAVE_MODE_NONE:
ESP_LOGCONFIG(TAG, "Save mode set to NONE");
case SAVE_MODE_FRAM:
ESP_LOGCONFIG(TAG, "Save mode set to FRAM");
break;
default:
ESP_LOGCONFIG(TAG, "Currently only NONE(0) && FRAM(1) save modes supported, ignoring value %" PRIu8 " and defaulting to NONE!", this->save_mode_);
this->save_mode_ = 0;
}
}
void DynamicLamp::set_lamp_count(uint8_t lamp_count) {
}
void DynamicLamp::set_lamp_values_(uint8_t lamp_number, bool active, uint16_t selected_outputs, uint8_t mode, uint8_t mode_value) {
}
void DynamicLamp::restore_lamp_values_(uint8_t lamp_number) {
this->active_lamps_[lamp_number].active = false;
}
} // namespace dynamic_lamp
} // namespace esphome