mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
add E32V2_2 single led as system sensor
This commit is contained in:
@@ -56,8 +56,7 @@ void IRAM_ATTR AnalogSensor::freqIrq2() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void AnalogSensor::start(const bool factory_settings) {
|
void AnalogSensor::start(const bool factory_settings) {
|
||||||
// if (factory_settings && EMSESP::nvs_.getString("boot").equals("E32V2_2")) {
|
if (factory_settings && EMSESP::system_.board_profile() == "E32V2_2") {
|
||||||
if (factory_settings && analogReadMilliVolts(39) > 700) { // core voltage > 2.6V
|
|
||||||
EMSESP::webCustomizationService.update([&](WebCustomization & settings) {
|
EMSESP::webCustomizationService.update([&](WebCustomization & settings) {
|
||||||
auto newSensor = AnalogCustomization();
|
auto newSensor = AnalogCustomization();
|
||||||
strcpy(newSensor.name, "core_voltage");
|
strcpy(newSensor.name, "core_voltage");
|
||||||
@@ -75,6 +74,13 @@ void AnalogSensor::start(const bool factory_settings) {
|
|||||||
newSensor.is_system = true;
|
newSensor.is_system = true;
|
||||||
settings.analogCustomizations.push_back(newSensor);
|
settings.analogCustomizations.push_back(newSensor);
|
||||||
|
|
||||||
|
strcpy(newSensor.name, "led");
|
||||||
|
newSensor.gpio = 2;
|
||||||
|
newSensor.type = AnalogType::DIGITAL_OUT;
|
||||||
|
newSensor.uom = DeviceValueUOM::NONE; // unchanged after restart
|
||||||
|
newSensor.factor = 1; // active high
|
||||||
|
settings.analogCustomizations.push_back(newSensor);
|
||||||
|
|
||||||
return StateUpdateResult::CHANGED; // persist the change
|
return StateUpdateResult::CHANGED; // persist the change
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ uuid::log::Logger TemperatureSensor::logger_{F_(temperaturesensor), uuid::log::F
|
|||||||
|
|
||||||
// start the 1-wire
|
// start the 1-wire
|
||||||
void TemperatureSensor::start(const bool factory_settings) {
|
void TemperatureSensor::start(const bool factory_settings) {
|
||||||
// set_internal_ = factory_settings && EMSESP::nvs_.getString("boot").equals("E32V2_2") && EMSESP::nvs_.getString("hwrevision").equals("3.0");
|
set_internal_ = factory_settings && EMSESP::system_.board_profile() == "E32V2_2";
|
||||||
set_internal_ = factory_settings && analogReadMilliVolts(39) > 700; // core voltage > 2.6V
|
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
if (!dallas_gpio_) {
|
if (!dallas_gpio_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user