|
|
@ -32,9 +32,10 @@ int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { |
|
|
|
int len; |
|
|
|
int len; |
|
|
|
|
|
|
|
|
|
|
|
len = os_sprintf(buff, |
|
|
|
len = os_sprintf(buff, |
|
|
|
"{ \"reset\":%d, \"isp\":%d, \"conn\":%d, \"ser\":%d, \"swap\":%d, \"rxpup\":%d }", |
|
|
|
"{ \"reset\":%d, \"isp\":%d, \"conn\":%d, \"ser\":%d, \"swap\":%d, \"rxpup\":%d, \"txen\":%d }", |
|
|
|
flashConfig.reset_pin, flashConfig.isp_pin, flashConfig.conn_led_pin, |
|
|
|
flashConfig.reset_pin, flashConfig.isp_pin, flashConfig.conn_led_pin, |
|
|
|
flashConfig.ser_led_pin, !!flashConfig.swap_uart, !!flashConfig.rx_pullup); |
|
|
|
flashConfig.ser_led_pin, !!flashConfig.swap_uart, !!flashConfig.rx_pullup, |
|
|
|
|
|
|
|
flashConfig.tx_enable_pin); |
|
|
|
|
|
|
|
|
|
|
|
jsonHeader(connData, 200); |
|
|
|
jsonHeader(connData, 200); |
|
|
|
httpdSend(connData, buff, len); |
|
|
|
httpdSend(connData, buff, len); |
|
|
@ -48,7 +49,7 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int8_t ok = 0; |
|
|
|
int8_t ok = 0; |
|
|
|
int8_t reset, isp, conn, ser; |
|
|
|
int8_t reset, isp, conn, ser, tx_enable; |
|
|
|
uint8_t swap, rxpup; |
|
|
|
uint8_t swap, rxpup; |
|
|
|
ok |= getInt8Arg(connData, "reset", &reset); |
|
|
|
ok |= getInt8Arg(connData, "reset", &reset); |
|
|
|
ok |= getInt8Arg(connData, "isp", &isp); |
|
|
|
ok |= getInt8Arg(connData, "isp", &isp); |
|
|
@ -56,6 +57,7 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) { |
|
|
|
ok |= getInt8Arg(connData, "ser", &ser); |
|
|
|
ok |= getInt8Arg(connData, "ser", &ser); |
|
|
|
ok |= getBoolArg(connData, "swap", &swap); |
|
|
|
ok |= getBoolArg(connData, "swap", &swap); |
|
|
|
ok |= getBoolArg(connData, "rxpup", &rxpup); |
|
|
|
ok |= getBoolArg(connData, "rxpup", &rxpup); |
|
|
|
|
|
|
|
ok |= getInt8Arg(connData, "txen", &tx_enable); |
|
|
|
if (ok < 0) return HTTPD_CGI_DONE; |
|
|
|
if (ok < 0) return HTTPD_CGI_DONE; |
|
|
|
|
|
|
|
|
|
|
|
char *coll; |
|
|
|
char *coll; |
|
|
@ -75,6 +77,10 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) { |
|
|
|
if (pins & (1<<ser)) { coll = "Serial LED"; goto collision; } |
|
|
|
if (pins & (1<<ser)) { coll = "Serial LED"; goto collision; } |
|
|
|
pins |= 1 << ser; |
|
|
|
pins |= 1 << ser; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (tx_enable >= 0) { |
|
|
|
|
|
|
|
if (pins & (1<<tx_enable)) { coll = "TX Enable"; goto collision; } |
|
|
|
|
|
|
|
pins |= 1 << tx_enable; |
|
|
|
|
|
|
|
} |
|
|
|
if (swap) { |
|
|
|
if (swap) { |
|
|
|
if (pins & (1<<15)) { coll = "Uart TX"; goto collision; } |
|
|
|
if (pins & (1<<15)) { coll = "Uart TX"; goto collision; } |
|
|
|
if (pins & (1<<13)) { coll = "Uart RX"; goto collision; } |
|
|
|
if (pins & (1<<13)) { coll = "Uart RX"; goto collision; } |
|
|
@ -90,8 +96,9 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) { |
|
|
|
flashConfig.ser_led_pin = ser; |
|
|
|
flashConfig.ser_led_pin = ser; |
|
|
|
flashConfig.swap_uart = swap; |
|
|
|
flashConfig.swap_uart = swap; |
|
|
|
flashConfig.rx_pullup = rxpup; |
|
|
|
flashConfig.rx_pullup = rxpup; |
|
|
|
os_printf("Pins changed: reset=%d isp=%d conn=%d ser=%d swap=%d rx-pup=%d\n", |
|
|
|
flashConfig.tx_enable_pin = tx_enable; |
|
|
|
reset, isp, conn, ser, swap, rxpup); |
|
|
|
os_printf("Pins changed: reset=%d isp=%d conn=%d ser=%d swap=%d rx-pup=%d tx_enable=%d\n", |
|
|
|
|
|
|
|
reset, isp, conn, ser, swap, rxpup, tx_enable); |
|
|
|
|
|
|
|
|
|
|
|
// apply the changes
|
|
|
|
// apply the changes
|
|
|
|
serbridgeInitPins(); |
|
|
|
serbridgeInitPins(); |
|
|
|