short colour_pair::get_any_id(short fg, short bg) { short slot=find_slot_with_colour(fg, bg); if(slot==-1) { //the pair does not currently have a slot slot=get_first_free_slot(); } ++slot_counts[slot]; ++slot; //now the "id" init_pair_with_id(slot, fg, bg); return slot; }
LOCAL void ICACHE_FLASH_ATTR at_tcpserver_listen(void *arg) { struct espconn *pespconn = (struct espconn *) arg; int8_t first_free_slot = get_first_free_slot(); if (first_free_slot == -1) return; slot[first_free_slot].free = FALSE; slot[first_free_slot].pCon = pespconn; slot[first_free_slot].len = 0; // slot[first_free_slot].linkId = linkId_counter++; pespconn->reverse = &slot[first_free_slot]; debug_print_str_tcp("at_tcpserver_listen \n\r"); espconn_regist_time(pespconn, 0, 15); // 15s timeout espconn_regist_recvcb(pespconn, at_tcpclient_recv); espconn_regist_reconcb(pespconn, at_tcpserver_recon_cb); espconn_regist_disconcb(pespconn, at_tcpserver_discon_cb); espconn_regist_sentcb(pespconn, at_tcpclient_sent_cb); }