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
+6
-5
@@ -3,8 +3,9 @@
|
||||
PlatformIO environments: `esp32` (OTA) and `esp32_usb` (USB)
|
||||
|
||||
The ESP32 decides what is shown on the display. It never touches the panel itself. The
|
||||
BROSE9323 driver is built with `-D ESPSERIAL`, so every GFX call is sent over `Serial`
|
||||
(115200 baud) to the Nano.
|
||||
BROSE9323 driver is built with `-D ESPSERIAL`, so every GFX call is sent to the Nano over
|
||||
`Serial2` (UART2, GPIO 17 TX / GPIO 16 RX, 115200 baud). `Serial` (USB) is only used for
|
||||
debug output. Wiring is described in the [main README](../../README.md#wiring-between-esp32-and-nano).
|
||||
|
||||
## Files
|
||||
|
||||
@@ -40,10 +41,10 @@ BROSE9323 driver is built with `-D ESPSERIAL`, so every GFX call is sent over `S
|
||||
|
||||
| Time | Display |
|
||||
|------|---------|
|
||||
| 07:00 – 17:00 | Pikachu and the clock, updated every minute |
|
||||
| 08:00 – 17:00 | Pikachu and the clock, updated every minute |
|
||||
| 17:00 – 22:00 | Yawning Pikachu and the clock |
|
||||
| 22:00 – 23:30 | Clock drawn only on the quarter hour; power is off in between |
|
||||
| night | Screen cleared, power off |
|
||||
| 22:00 – 23:30 | Clock shown only during the minutes :00, :15, :30 and :45; power is off in between |
|
||||
| 23:31 – 08:00 | Screen cleared, power off |
|
||||
|
||||
## Adding bitmaps
|
||||
|
||||
|
||||
+4
-1
@@ -45,7 +45,10 @@ bool power = true;
|
||||
|
||||
const int led1 = BUILTIN_LED; // Pin of the LED
|
||||
const int relay = 13; // Pin of the relay, powers the panels and the Nano (LOW = on)
|
||||
const int nano_tx = 1; // UART0 TX, wired to the Nano RX
|
||||
// Link to the Nano on UART2. Serial (UART0) stays free for USB / debug output.
|
||||
HardwareSerial &nanoSerial = Serial2;
|
||||
const int nano_rx = 16; // UART2 RX, wired to the Nano TX (through a 5V -> 3.3V divider)
|
||||
const int nano_tx = 17; // UART2 TX, wired to the Nano RX
|
||||
bool relay_on = false;
|
||||
// Max wait for the Nano's READY after power on (also the wait when Nano TX is not wired to our RX)
|
||||
const uint32_t NANO_BOOT_TIMEOUT = 3000;
|
||||
|
||||
+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