From 8c5d809280904562aee082e2eab4ceb9f8523d9d Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sun, 10 Mar 2013 22:55:21 +0100 Subject: Updates to WiFi shield firmware. --- firmwares/wifishield/wifiHD/src/main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index 8961e35..297e015 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -39,7 +39,7 @@ #include /* FIRMWARE version */ -const char* fwVersion = "1.0.0"; +const char* fwVersion = "1.1.0"; #if BOARD == ARDUINO #if !defined(DATAFLASH) @@ -89,14 +89,7 @@ bool scanNetCompleted = false; static bool initSpiComplete = false; // variable used as enable flag for debug prints -#ifdef _DEBUG_ -uint16_t enableDebug = DEFAULT_INFO_FLAG | INFO_WARN_FLAG;// | INFO_SPI_FLAG; -uint16_t verboseDebug = 0; -#else -uint16_t enableDebug = DEFAULT_INFO_FLAG; -uint16_t verboseDebug = 0; -#endif - +DEFINE_DEBUG_VARIABLES(); /** * @@ -287,6 +280,7 @@ void initShell() console_add_cmd("setkey", cmd_setkey, NULL); console_add_cmd("status", cmd_status, NULL); console_add_cmd("debug", cmd_debug, NULL); + console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); #ifdef ADD_CMDS console_add_cmd("powersave", cmd_power, NULL); @@ -307,8 +301,11 @@ void initShell() #ifdef _DNS_CMD_ console_add_cmd("getHost", cmd_gethostbyname, NULL); console_add_cmd("setDNS", cmd_setDnsServer, NULL); - console_add_cmd("startTcpSrv", cmd_startTcpSrv, NULL); #endif + console_add_cmd("startSrv", cmd_startSrv, NULL); + console_add_cmd("startCli", cmd_startCli, NULL); + console_add_cmd("sendUdp", cmd_sendUdpData, NULL); + } /** @@ -359,7 +356,9 @@ void startup_init(void) // if DEBUG enabled use DEB_PIN_GPIO for debug purposes DEB_PIN_ENA(); + DEB_PIN_ENA(2); DEB_PIN_UP(); + DEB_PIN_UP(2); } /** -- cgit v1.2.3-18-g5258 From f0ba738a71ec8dafe4705ddd02c07a2eb880655c Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sun, 17 Mar 2013 19:23:16 +0100 Subject: Fix issue related to multiple client opened on web server sketch --- firmwares/wifishield/wifiHD/src/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index 297e015..e94e724 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -281,6 +281,7 @@ void initShell() console_add_cmd("status", cmd_status, NULL); console_add_cmd("debug", cmd_debug, NULL); console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); + console_add_cmd("ipconfig", cmd_set_ip, NULL); #ifdef ADD_CMDS console_add_cmd("powersave", cmd_power, NULL); -- cgit v1.2.3-18-g5258 From e43ed7d47d9b2c37ccff6dc75d6bfe4c8a55ac86 Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Thu, 21 Mar 2013 09:24:07 +0100 Subject: Added API to set static IP and DNS server --- firmwares/wifishield/wifiHD/src/main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index e94e724..4b1f06f 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -78,11 +78,6 @@ void fw_download_cb(void* ctx, uint8_t** buf, uint32_t* len) #endif #endif -struct ctx_server { - struct net_cfg net_cfg; - uint8_t wl_init_complete; -}; - bool ifStatus = false; bool scanNetCompleted = false; @@ -122,7 +117,7 @@ wl_cm_conn_cb(struct wl_network_t* net, void* ctx) hs->net_cfg.dhcp_running = 1; } else { - netif_set_up(hs->net_cfg.netif); + netif_set_up(hs->net_cfg.netif); } INFO_INIT("Start DNS...\n"); @@ -270,7 +265,7 @@ poll(struct ctx_server* hs) #endif } -void initShell() +void initShell(void* ctx) { /* initialize shell */ INFO_INIT("Shell init...\n"); @@ -281,7 +276,7 @@ void initShell() console_add_cmd("status", cmd_status, NULL); console_add_cmd("debug", cmd_debug, NULL); console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); - console_add_cmd("ipconfig", cmd_set_ip, NULL); + console_add_cmd("ipconfig", cmd_set_ip, ctx); #ifdef ADD_CMDS console_add_cmd("powersave", cmd_power, NULL); @@ -325,6 +320,7 @@ wl_init_complete_cb(void* ctx) /* default is dhcp enabled */ hs->net_cfg.dhcp_enabled = 1; + start_ip_stack(&hs->net_cfg, ipaddr, netmask, @@ -339,7 +335,7 @@ wl_init_complete_cb(void* ctx) wl_scan(); - if (initSpi()){ + if (initSpi(hs)){ WARN("Spi not initialized\n"); }else { @@ -381,8 +377,6 @@ main(void) tc_init(); - initShell(); - delay_init(FOSC0); #ifdef _TEST_SPI_ @@ -408,7 +402,7 @@ main(void) INFO_INIT("hs:%p size:0x%x netif:%p size:0x%x\n", hs, size_ctx_server, hs->net_cfg.netif, size_netif); - + initShell(hs); timer_init(NULL, NULL); lwip_init(); -- cgit v1.2.3-18-g5258 From 6265d401817934c4b2d9ee3bf8dab44de1bb08cb Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Tue, 26 Mar 2013 19:49:19 +0100 Subject: Fix issue on client side --- firmwares/wifishield/wifiHD/src/main.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index 4b1f06f..5800ba8 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -277,7 +277,6 @@ void initShell(void* ctx) console_add_cmd("debug", cmd_debug, NULL); console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); console_add_cmd("ipconfig", cmd_set_ip, ctx); - #ifdef ADD_CMDS console_add_cmd("powersave", cmd_power, NULL); console_add_cmd("psconf", cmd_psconf, NULL); @@ -314,12 +313,15 @@ wl_init_complete_cb(void* ctx) struct ip_addr ipaddr, netmask, gw; wl_err_t wl_status; - IP4_ADDR(&gw, 0,0,0,0); - IP4_ADDR(&ipaddr, 0,0,0,0); - IP4_ADDR(&netmask, 0,0,0,0); - - /* default is dhcp enabled */ - hs->net_cfg.dhcp_enabled = 1; + if (hs->net_cfg.dhcp_enabled == INIT_IP_CONFIG) + { + IP4_ADDR(&gw, 0,0,0,0); + IP4_ADDR(&ipaddr, 0,0,0,0); + IP4_ADDR(&netmask, 0,0,0,0); + + /* default is dhcp enabled */ + hs->net_cfg.dhcp_enabled = DYNAMIC_IP_CONFIG; + } start_ip_stack(&hs->net_cfg, ipaddr, @@ -358,6 +360,8 @@ void startup_init(void) DEB_PIN_UP(2); } +const char timestamp[] = __TIMESTAMP__; + /** * */ @@ -390,7 +394,7 @@ main(void) } #else - printk("Arduino Wifi Startup... [%s]\n", __TIMESTAMP__); + printk("Arduino Wifi Startup... [%s]\n", timestamp); size_t size_ctx_server = sizeof(struct ctx_server); hs = calloc(1, size_ctx_server); @@ -399,6 +403,7 @@ main(void) size_t size_netif = sizeof(struct netif); hs->net_cfg.netif = calloc(1, size_netif); ASSERT(hs->net_cfg.netif, "out of memory"); + hs->net_cfg.dhcp_enabled = INIT_IP_CONFIG; INFO_INIT("hs:%p size:0x%x netif:%p size:0x%x\n", hs, size_ctx_server, hs->net_cfg.netif, size_netif); -- cgit v1.2.3-18-g5258 From 881e9430a17de82334b65041150a3c122d342f41 Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Tue, 26 Mar 2013 22:26:21 +0100 Subject: Fix print message on dhcp status --- firmwares/wifishield/wifiHD/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index 5800ba8..fffb34e 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -109,7 +109,7 @@ wl_cm_conn_cb(struct wl_network_t* net, void* ctx) INFO_INIT("Connection cb...\n"); printk("link up, connected to \"%s\"\n", ssid2str(&net->ssid)); - if ( hs->net_cfg.dhcp_enabled ) { + if ( hs->net_cfg.dhcp_enabled == DYNAMIC_IP_CONFIG ) { INFO_INIT("Start DHCP...\n"); printk("requesting dhcp ... "); int8_t result = dhcp_start(hs->net_cfg.netif); @@ -273,7 +273,7 @@ void initShell(void* ctx) console_add_cmd("scan", cmd_scan, NULL); console_add_cmd("connect", cmd_connect, NULL); console_add_cmd("setkey", cmd_setkey, NULL); - console_add_cmd("status", cmd_status, NULL); + console_add_cmd("status", cmd_status, ctx); console_add_cmd("debug", cmd_debug, NULL); console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); console_add_cmd("ipconfig", cmd_set_ip, ctx); -- cgit v1.2.3-18-g5258