Public Access
Move the Nano link to Serial2, update READMEs
- ESP32 talks to the Nano on UART2 (GPIO 17 TX / GPIO 16 RX); Serial (USB) is now free for debug output and boot messages no longer reach the Nano - README: wiring table, actual schedule (clock from 08:00), TODO section for the rewiring Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c67a90ba09
commit
75f677a2eb
6 files changed
+58
-29
No files matched your search
+8
-8
@@ -14,9 +14,9 @@ void waitForNano()
|
||||
uint32_t start = millis();
|
||||
while (millis() - start < NANO_BOOT_TIMEOUT)
|
||||
{
|
||||
while (Serial.available())
|
||||
while (nanoSerial.available())
|
||||
{
|
||||
char c = Serial.read();
|
||||
char c = nanoSerial.read();
|
||||
if (c == '\n')
|
||||
{
|
||||
line[len] = '\0';
|
||||
@@ -39,10 +39,10 @@ void relayOn()
|
||||
if (relay_on)
|
||||
return;
|
||||
|
||||
Serial.begin(115200);
|
||||
nanoSerial.begin(115200, SERIAL_8N1, nano_rx, nano_tx);
|
||||
// drop old data (e.g. ERR replies) so only a new READY counts
|
||||
while (Serial.available())
|
||||
Serial.read();
|
||||
while (nanoSerial.available())
|
||||
nanoSerial.read();
|
||||
|
||||
digitalWrite(relay, LOW);
|
||||
waitForNano();
|
||||
@@ -55,8 +55,8 @@ void relayOff()
|
||||
relay_on = false;
|
||||
|
||||
// An idle UART TX line is high and would power the Nano through its RX pin
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
nanoSerial.flush();
|
||||
nanoSerial.end();
|
||||
pinMode(nano_tx, INPUT);
|
||||
}
|
||||
void turnPowerOff(uint32_t delay = 30000, bool _turn_hassio_power_off = false)
|
||||
@@ -289,7 +289,7 @@ void setup()
|
||||
pinMode(relay, OUTPUT);
|
||||
relayOn();
|
||||
|
||||
display.begin(&Serial);
|
||||
display.begin(&nanoSerial);
|
||||
// display.setTiming(200);
|
||||
// display.setTiming(180);
|
||||
// display.setTiming(220); // works best so far
|
||||
|
||||
Reference in new issue
Block a user