Skip to content

Commit

Permalink
fix pin change collision detection
Browse files Browse the repository at this point in the history
  • Loading branch information
tve committed Nov 16, 2015
1 parent d156618 commit 5bb5173
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions esp-link/cgipins.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) {
pins |= 1 << ser;
}
if (swap) {
if (pins & (1<<1)) { coll = "Uart TX"; goto collision; }
if (pins & (1<<3)) { coll = "Uart RX"; goto collision; }
} else {
if (pins & (1<<15)) { coll = "Uart TX"; goto collision; }
if (pins & (1<<13)) { coll = "Uart RX"; goto collision; }
} else {
if (pins & (1<<1)) { coll = "Uart TX"; goto collision; }
if (pins & (1<<3)) { coll = "Uart RX"; goto collision; }
}

// we're good, set flashconfig
Expand All @@ -90,6 +90,8 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) {
flashConfig.ser_led_pin = ser;
flashConfig.swap_uart = swap;
flashConfig.rx_pullup = rxpup;
os_printf("Pins changed: reset=%d isp=%d conn=%d ser=%d swap=%d rx-pup=%d\n",
reset, isp, conn, ser, swap, rxpup);

// apply the changes
serbridgeInitPins();
Expand Down

0 comments on commit 5bb5173

Please sign in to comment.