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:
56
esphome/components/dynamic_lamp/dynamic_lamp.cpp
Normal file
56
esphome/components/dynamic_lamp/dynamic_lamp.cpp
Normal 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
|
Reference in New Issue
Block a user