Add support for second LED (Amica only), Fix duplicate "build_flags" introduced in 9266490
This commit is contained in:
parent
8f37203b79
commit
f34259c63e
@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[common_env_data]
|
||||
build_flags = '-D BUILD_VERSION="0.8.2*"'
|
||||
build_flags = '-D BUILD_VERSION="0.8.3*"'
|
||||
|
||||
[platformio]
|
||||
default_envs = esp12e
|
||||
@ -24,7 +24,6 @@ lib_deps =
|
||||
ropg/ezTime@^0.8.3
|
||||
paulstoffregen/OneWire@^2.3.7
|
||||
milesburton/DallasTemperature@^3.11.0
|
||||
build_flags = ${common_env_data.build_flags}
|
||||
build_flags = ${common_env_data.build_flags} -D BUILD_DEBUG=0
|
||||
|
||||
[env:esp12e_debug]
|
||||
|
23
src/main.cpp
23
src/main.cpp
@ -302,7 +302,7 @@ void timer() {
|
||||
sprintf(t_stat[r], "off");
|
||||
if (!override[r]) {
|
||||
digitalWrite(pins[r], LOW);
|
||||
analogWrite(LED_BUILTIN, 0); // LED
|
||||
analogWrite(LED_BUILTIN_AUX, 0); // LED
|
||||
if (strcmp(stat[r], "AN") == 0) {
|
||||
debug(r);
|
||||
debugln(F(" is off"));
|
||||
@ -314,6 +314,19 @@ void timer() {
|
||||
}
|
||||
}
|
||||
|
||||
uint ledBrightness = 0;
|
||||
int ledBrightnessStep = 20;
|
||||
uint lastLedCycle;
|
||||
void pulseLed() {
|
||||
if (millis() - lastLedCycle > 100) {
|
||||
analogWrite(LED_BUILTIN_AUX, ledBrightness);
|
||||
ledBrightness += ledBrightnessStep;
|
||||
if (ledBrightness <= 0 || ledBrightness >= 255) {
|
||||
ledBrightnessStep = -ledBrightnessStep;
|
||||
}
|
||||
lastLedCycle = millis();
|
||||
}
|
||||
}
|
||||
|
||||
void emergencyStop() {
|
||||
for (uint pin = 0; pin < sizeof(pins) / sizeof(pins[0]); pin++) {
|
||||
@ -328,10 +341,13 @@ void emergencyStop() {
|
||||
unsigned long lastTry = millis();
|
||||
while (millis() - lastTry < (1000 * 60)) {
|
||||
analogWrite(LED_BUILTIN, 255);
|
||||
analogWrite(LED_BUILTIN_AUX, 0);
|
||||
delay(125);
|
||||
analogWrite(LED_BUILTIN, 0);
|
||||
analogWrite(LED_BUILTIN_AUX, 255);
|
||||
delay(125);
|
||||
analogWrite(LED_BUILTIN, 255);
|
||||
analogWrite(LED_BUILTIN_AUX, 255);
|
||||
delay(250);
|
||||
}
|
||||
ESP.restart();
|
||||
@ -350,7 +366,9 @@ void getCurrentTemperature() {
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
pinMode(LED_BUILTIN_AUX, OUTPUT);
|
||||
analogWrite(LED_BUILTIN, 255);
|
||||
analogWrite(LED_BUILTIN_AUX, 255);
|
||||
uint p = 0;
|
||||
while (p <= sizeof(pins) / sizeof(pins[0])) {
|
||||
pinMode(pins[p], OUTPUT);
|
||||
@ -379,6 +397,7 @@ void setup() {
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(250);
|
||||
debug(F("."));
|
||||
analogWrite(LED_BUILTIN_AUX, 255 * (notConnectedCounter % 2)); // LED
|
||||
notConnectedCounter++;
|
||||
if (notConnectedCounter >
|
||||
(1000 / 250) * 15) { // Reset board if not connected after 15s
|
||||
@ -386,6 +405,7 @@ void setup() {
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
analogWrite(LED_BUILTIN_AUX, 0);
|
||||
debug(F("\nConnected to "));
|
||||
debugln(WiFi.SSID());
|
||||
debug(F("IP address: "));
|
||||
@ -431,4 +451,5 @@ void loop() {
|
||||
delay(50);
|
||||
events();
|
||||
ArduinoOTA.handle();
|
||||
pulseLed();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user