|
|
@ -24,15 +24,13 @@ static const int num_map_func = sizeof(map_func)/sizeof(char*); |
|
|
|
|
|
|
|
|
|
|
|
// Cgi to return choice of pin assignments
|
|
|
|
// Cgi to return choice of pin assignments
|
|
|
|
int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { |
|
|
|
int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { |
|
|
|
char buff[1024]; |
|
|
|
if (connData->conn==NULL) return HTTPD_CGI_DONE; // Connection aborted
|
|
|
|
int len; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (connData->conn==NULL) { |
|
|
|
char buff[2048]; |
|
|
|
return HTTPD_CGI_DONE; // Connection aborted
|
|
|
|
int len; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// figure out current mapping
|
|
|
|
// figure out current mapping
|
|
|
|
int curr = 99; |
|
|
|
int curr = 0; |
|
|
|
for (int i=0; i<num_map_names; i++) { |
|
|
|
for (int i=0; i<num_map_names; i++) { |
|
|
|
int8_t *map = map_asn[i]; |
|
|
|
int8_t *map = map_asn[i]; |
|
|
|
if (map[0] == flashConfig.reset_pin && map[1] == flashConfig.isp_pin && |
|
|
|
if (map[0] == flashConfig.reset_pin && map[1] == flashConfig.isp_pin && |
|
|
@ -42,6 +40,7 @@ int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// print mapping
|
|
|
|
len = os_sprintf(buff, "{ \"curr\":\"%s\", \"map\": [ ", map_names[curr]); |
|
|
|
len = os_sprintf(buff, "{ \"curr\":\"%s\", \"map\": [ ", map_names[curr]); |
|
|
|
for (int i=0; i<num_map_names; i++) { |
|
|
|
for (int i=0; i<num_map_names; i++) { |
|
|
|
if (i != 0) buff[len++] = ','; |
|
|
|
if (i != 0) buff[len++] = ','; |
|
|
@ -52,8 +51,12 @@ int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { |
|
|
|
len += os_sprintf(buff+len, ", \"descr\":\""); |
|
|
|
len += os_sprintf(buff+len, ", \"descr\":\""); |
|
|
|
for (int f=0; f<num_map_func; f++) { |
|
|
|
for (int f=0; f<num_map_func; f++) { |
|
|
|
int8_t p = map_asn[i][f]; |
|
|
|
int8_t p = map_asn[i][f]; |
|
|
|
if (p >= 0) len += os_sprintf(buff+len, " %s:gpio%d", map_func[f], p); |
|
|
|
if (f == 4) |
|
|
|
else len += os_sprintf(buff+len, " %s:n/a", map_func[f]); |
|
|
|
len += os_sprintf(buff+len, " %s:%s", map_func[f], p?"yes":"no"); |
|
|
|
|
|
|
|
else if (p >= 0) |
|
|
|
|
|
|
|
len += os_sprintf(buff+len, " %s:gpio%d", map_func[f], p); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
len += os_sprintf(buff+len, " %s:n/a", map_func[f]); |
|
|
|
} |
|
|
|
} |
|
|
|
len += os_sprintf(buff+len, "\" }"); |
|
|
|
len += os_sprintf(buff+len, "\" }"); |
|
|
|
} |
|
|
|
} |
|
|
@ -89,6 +92,7 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) { |
|
|
|
flashConfig.isp_pin = map[1]; |
|
|
|
flashConfig.isp_pin = map[1]; |
|
|
|
flashConfig.conn_led_pin = map[2]; |
|
|
|
flashConfig.conn_led_pin = map[2]; |
|
|
|
flashConfig.ser_led_pin = map[3]; |
|
|
|
flashConfig.ser_led_pin = map[3]; |
|
|
|
|
|
|
|
flashConfig.swap_uart = map[4]; |
|
|
|
|
|
|
|
|
|
|
|
serbridgeInitPins(); |
|
|
|
serbridgeInitPins(); |
|
|
|
serledInit(); |
|
|
|
serledInit(); |
|
|
|