Fix a few errors..

pull/205/head
Alex 9 years ago
parent 3fdfe93bd4
commit 3f161215dd
  1. 12
      serial/serbridge.c

@ -19,7 +19,6 @@
static struct espconn serbridgeConn[1]; // plain bridging port static struct espconn serbridgeConn[1]; // plain bridging port
static struct espconn serbridgeConn[2]; // programming port static struct espconn serbridgeConn[2]; // programming port
static esp_tcp serbridgeTcp[1], serbridgeTcp[2]; static esp_tcp serbridgeTcp[1], serbridgeTcp[2];
static esp_tcp serbridgeTcp1, serbridgeTcp2;
static int8_t mcu_reset_pin, mcu_isp_pin; static int8_t mcu_reset_pin, mcu_isp_pin;
uint8_t in_mcu_flashing; // for disabling slip during MCU flashing uint8_t in_mcu_flashing; // for disabling slip during MCU flashing
@ -487,7 +486,7 @@ serbridgeStart(int ix, int port, int mode)
if (ix < 0 || ix > 2) // FIXME hardcoded limit if (ix < 0 || ix > 2) // FIXME hardcoded limit
return; return;
if (serbridgeConn[ix] != NULL) { serbridgeCleanup(serbridgeConn[ix]); } //If we are already initialized, let's clean it up. if (serbridgeConn[ix] != NULL) { serbridgeCleanup(ix); } //If we are already initialized, let's clean it up.
if (0 < port && port < 65536 && port != 80) { if (0 < port && port < 65536 && port != 80) {
serbridgeConn[ix].type = ESPCONN_TCP; serbridgeConn[ix].type = ESPCONN_TCP;
serbridgeConn[ix].state = ESPCONN_NONE; serbridgeConn[ix].state = ESPCONN_NONE;
@ -502,13 +501,12 @@ serbridgeStart(int ix, int port, int mode)
} }
static void ICACHE_FLASH_ATTR static void ICACHE_FLASH_ATTR
serbridgeCleanup(void *arg) serbridgeCleanup(int ix)
{ {
serbridgeConnData *conn = ((struct espconn*)arg)->reverse; if (serbridgeConn[ix] == NULL) return;
if (conn == NULL) return;
// Free memory & set to NULL // Free memory & set to NULL
os_free(conn); os_free(serbridgeConn[ix]);
conn = NULL; serbridgeConn[ix] = NULL;
} }
int ICACHE_FLASH_ATTR serbridgeInMCUFlashing() int ICACHE_FLASH_ATTR serbridgeInMCUFlashing()

Loading…
Cancel
Save