diff --git a/Makefile b/Makefile index 08f0dcd..a3df665 100644 --- a/Makefile +++ b/Makefile @@ -25,13 +25,13 @@ SDK_BASE ?= $(abspath ../esp_iot_sdk_v1.3.0) # Typically you'll use https://github.com/themadinventor/esptool # Windows users use the com port i.e: ESPPORT ?= com3 ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py) -ESPPORT ?= /dev/ttyUSB0 -ESPBAUD ?= 460800 +ESPPORT ?= com10 +ESPBAUD ?= 230400 # --------------- chipset configuration --------------- # Pick your flash size: "512KB", "1MB", or "4MB" -FLASH_SIZE ?= 4MB +FLASH_SIZE ?= 512KB ifeq ("$(FLASH_SIZE)","512KB") # Winbond 25Q40 512KB flash, typ for esp-01 thru esp-11 diff --git a/cmd/cmd.h b/cmd/cmd.h index 5a66bc7..23bd584 100644 --- a/cmd/cmd.h +++ b/cmd/cmd.h @@ -4,6 +4,7 @@ #ifndef CMD_H #define CMD_H +#include // Escape chars used by tuanpmt, dunno why he didn't use std ones... #define SLIP_START 0x7E diff --git a/esp-link.vcxproj b/esp-link.vcxproj index 1fc9e5c..2a774e9 100644 --- a/esp-link.vcxproj +++ b/esp-link.vcxproj @@ -28,7 +28,7 @@ __ets__;_STDINT_H;ICACHE_FLASH;__MINGW32__;__WIN32__ - .\cmd;.\serial;.\user;.\espfs;.\httpd;.\include;..\esp_iot_sdk_v1.3.0\include;C:\tools\mingw64\include + .\cmd;.\serial;.\user;.\espfs;.\httpd;.\include;..\esp_iot_sdk_v1.3.0\include;..\xtensa-lx106-elf\xtensa-lx106-elf\include;c:\tools\mingw64\x86_64-w64-mingw32\include;c:\tools\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.3\include diff --git a/html-old/console.html b/html-old/console.html new file mode 100644 index 0000000..db4c0a6 --- /dev/null +++ b/html-old/console.html @@ -0,0 +1,46 @@ +
+
+

Microcontroller Console

+
+ +
+

The Microcontroller console shows the last 1024 characters + received from UART0, to which a microcontroller is typically attached. + The UART is configured for 8 bits, no parity, 1 stop bit (8N1).

+

+ Reset µC +  Baud: + +

+

+    
+
+ + + + + + diff --git a/html/console.js b/html-old/console.js similarity index 100% rename from html/console.js rename to html-old/console.js diff --git a/html/favicon.ico b/html-old/favicon.ico old mode 100755 new mode 100644 similarity index 100% rename from html/favicon.ico rename to html-old/favicon.ico diff --git a/html-old/head- b/html-old/head- new file mode 100644 index 0000000..514ff53 --- /dev/null +++ b/html-old/head- @@ -0,0 +1,10 @@ + + + esp-link + + + + + + +
diff --git a/html-old/home.html b/html-old/home.html new file mode 100644 index 0000000..46a984d --- /dev/null +++ b/html-old/home.html @@ -0,0 +1,87 @@ +
+
+
JEELABS
+

esp-link

+

+
+ +
+
+
+

The JeeLabs esp-link firmware bridges the ESP8266 serial port to Wifi and can + program microcontrollers over the serial port, in particular Arduinos, AVRs, and + NXP's LPC800 and other ARM processors.

+

Program an Arduino/AVR using avrdude using a command + line similar to:

+
/home/arduino-1.0.5/hardware/tools/avrdude \
+   -DV -patmega328p -Pnet:esp-link.local:23 -carduino -b115200 -U \
+   -C /home/arduino-1.0.5/hardware/tools/avrdude.conf flash:w:my_sketch.hex:i +
+

where -Pnet:esp-link.local:23 tells avrdude to connect to port 23 of esp-link. + You can substitute the IP address of your esp-link for esp-link.local if necessary.

+

Please refer to + the online README + for up-to-date help and to the forthcoming + JeeLabs blog for an intro to the codebase.

+
+
+
+
+
+

Wifi summary

+
+ + + + + + + + +
+
+

TCP client

+
+ TCP client support in esp-link +
+ + +
+
+ Grovestreams data push +
+ + +
+
+ + +
+ +
+
+
+
+

Pin assignment

+ Select one of the following signal/pin assignments to match your hardware +
+
+
+
+
+
+
+
+
+
+ + + diff --git a/html/jl-400x110.png- b/html-old/jl-400x110.png- old mode 100755 new mode 100644 similarity index 100% rename from html/jl-400x110.png- rename to html-old/jl-400x110.png- diff --git a/html-old/log.html b/html-old/log.html new file mode 100644 index 0000000..46ec785 --- /dev/null +++ b/html-old/log.html @@ -0,0 +1,48 @@ +
+
+

Debug Log

+
+ +
+

The debug log shows the most recent characters printed by the esp-link software itself to + its own debug log.

+
+

+ Refresh +

+

+ UART debug log: + auto + off + on +

+
+

+    
+
+ + + + + + diff --git a/html/pure.css b/html-old/pure.css similarity index 100% rename from html/pure.css rename to html-old/pure.css diff --git a/html/style.css b/html-old/style.css similarity index 100% rename from html/style.css rename to html-old/style.css diff --git a/html/ui.js b/html-old/ui.js similarity index 100% rename from html/ui.js rename to html-old/ui.js diff --git a/html/wifi/icons.png b/html-old/wifi/icons.png similarity index 100% rename from html/wifi/icons.png rename to html-old/wifi/icons.png diff --git a/html-old/wifi/wifi.html b/html-old/wifi/wifi.html new file mode 100644 index 0000000..b6c142b --- /dev/null +++ b/html-old/wifi/wifi.html @@ -0,0 +1,84 @@ +
+
+

Wifi Configuration

+
+ +
+
+
+

Wifi State

+
+ + + + + + + + + + + +
+
+

Wifi Association

+ +
+ To connect to a WiFi network, please select one of the detected networks, + enter the password, and hit the connect button... + +
Scanning...
+ + + +
+
+
+
+
+

Special Settings

+
+ Special settings, use with care! +
+ + +
+
+ + +
+
+ + + + + + +
+ +
+
+
+
+
+ + + + + + diff --git a/html/wifi/wifi.js b/html-old/wifi/wifi.js similarity index 100% rename from html/wifi/wifi.js rename to html-old/wifi/wifi.js diff --git a/html/console.html b/html/console.html index db4c0a6..549ae82 100644 --- a/html/console.html +++ b/html/console.html @@ -1,46 +1 @@ -
-
-

Microcontroller Console

-
- -
-

The Microcontroller console shows the last 1024 characters - received from UART0, to which a microcontroller is typically attached. - The UART is configured for 8 bits, no parity, 1 stop bit (8N1).

-

- Reset µC -  Baud: - -

-

-    
-
- - - - - - + diff --git a/html/head- b/html/head- index 514ff53..e69de29 100644 --- a/html/head- +++ b/html/head- @@ -1,10 +0,0 @@ - - - esp-link - - - - - - -
diff --git a/html/home.html b/html/home.html index 46a984d..2677264 100644 --- a/html/home.html +++ b/html/home.html @@ -1,87 +1 @@ -
-
-
JEELABS
-

esp-link

-

-
- -
-
-
-

The JeeLabs esp-link firmware bridges the ESP8266 serial port to Wifi and can - program microcontrollers over the serial port, in particular Arduinos, AVRs, and - NXP's LPC800 and other ARM processors.

-

Program an Arduino/AVR using avrdude using a command - line similar to:

-
/home/arduino-1.0.5/hardware/tools/avrdude \
-   -DV -patmega328p -Pnet:esp-link.local:23 -carduino -b115200 -U \
-   -C /home/arduino-1.0.5/hardware/tools/avrdude.conf flash:w:my_sketch.hex:i -
-

where -Pnet:esp-link.local:23 tells avrdude to connect to port 23 of esp-link. - You can substitute the IP address of your esp-link for esp-link.local if necessary.

-

Please refer to - the online README - for up-to-date help and to the forthcoming - JeeLabs blog for an intro to the codebase.

-
-
-
-
-
-

Wifi summary

-
- - - - - - - - -
-
-

TCP client

-
- TCP client support in esp-link -
- - -
-
- Grovestreams data push -
- - -
-
- - -
- -
-
-
-
-

Pin assignment

- Select one of the following signal/pin assignments to match your hardware -
-
-
-
-
-
-
-
-
-
- - - + diff --git a/html/log.html b/html/log.html index 46ec785..7bec267 100644 --- a/html/log.html +++ b/html/log.html @@ -1,48 +1 @@ -
-
-

Debug Log

-
- -
-

The debug log shows the most recent characters printed by the esp-link software itself to - its own debug log.

-
-

- Refresh -

-

- UART debug log: - auto - off - on -

-
-

-    
-
- - - - - - + diff --git a/html/wifi/wifi.html b/html/wifi/wifi.html index b6c142b..a6dd616 100644 --- a/html/wifi/wifi.html +++ b/html/wifi/wifi.html @@ -1,84 +1 @@ -
-
-

Wifi Configuration

-
- -
-
-
-

Wifi State

-
- - - - - - - - - - - -
-
-

Wifi Association

- -
- To connect to a WiFi network, please select one of the detected networks, - enter the password, and hit the connect button... - -
Scanning...
- - - -
-
-
-
-
-

Special Settings

-
- Special settings, use with care! -
- - -
-
- - -
-
- - - - - - -
- -
-
-
-
-
- - - - - - + diff --git a/user/user_main.c b/user/user_main.c index 54ca59e..cf6d266 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -48,7 +48,6 @@ int myPassFn(HttpdConnData *connData, int no, char *user, int userLen, char *pas return 0; } - /* This is the main url->function dispatching data struct. In short, it's a struct with various URLs plus their handlers. The handlers can @@ -95,7 +94,6 @@ HttpdBuiltInUrl builtInUrls[]={ {NULL, NULL, NULL} }; - //#define SHOW_HEAP_USE #ifdef SHOW_HEAP_USE @@ -106,7 +104,36 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) { } #endif +# define VERS_STR_STR(V) #V +# define VERS_STR(V) VERS_STR_STR(V) +char *esp_link_version = VERS_STR(VERSION); + void user_rf_pre_init(void) { + // get the flash config so we know how to init things + //configWipe(); // uncomment to reset the config for testing purposes + bool restoreOk = configRestore(); + + // init gpio pin registers + gpio_init(); + + // init UART + uart_init(flashConfig.baud_rate, 115200); + logInit(); // must come after init of uart + + // say hello (leave some time to cause break in TX after boot loader's msg + os_delay_us(10000L); + os_printf("\n\n** %s\n", esp_link_version); + os_printf("Flash config restore %s\n", restoreOk ? "ok" : "*FAILED*"); + + // Status LEDs + statusInit(); + serledInit(); + +#ifdef SHOW_HEAP_USE + os_timer_disarm(&prHeapTimer); + os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL); + os_timer_arm(&prHeapTimer, 10000, 1); +#endif } // address of espfs binary blob @@ -116,43 +143,23 @@ static char *rst_codes[] = { "normal", "wdt reset", "exception", "soft wdt", "restart", "deep sleep", "external", }; -# define VERS_STR_STR(V) #V -# define VERS_STR(V) VERS_STR_STR(V) -char *esp_link_version = VERS_STR(VERSION); - //Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done. void user_init(void) { - // get the flash config so we know how to init things - //configWipe(); // uncomment to reset the config for testing purposes - bool restoreOk = configRestore(); - // init gpio pin registers - gpio_init(); - // init UART - uart_init(flashConfig.baud_rate, 115200); - logInit(); // must come after init of uart - // say hello (leave some time to cause break in TX after boot loader's msg - os_delay_us(10000L); - os_printf("\n\n** %s\n", esp_link_version); - os_printf("Flash config restore %s\n", restoreOk ? "ok" : "*FAILED*"); - // Status LEDs - statusInit(); - serledInit(); // Wifi wifiInit(); + // init the flash filesystem with the html stuff espFsInit(&_binary_espfs_img_start); + //EspFsInitResult res = espFsInit(&_binary_espfs_img_start); //os_printf("espFsInit %s\n", res?"ERR":"ok"); + // mount the http handlers httpdInit(builtInUrls, 80); + // init the wifi-serial transparent bridge (port 23) serbridgeInit(23); uart_add_recv_cb(&serbridgeUartCb); -#ifdef SHOW_HEAP_USE - os_timer_disarm(&prHeapTimer); - os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL); - os_timer_arm(&prHeapTimer, 10000, 1); -#endif struct rst_info *rst_info = system_get_rst_info(); os_printf("Reset cause: %d=%s\n", rst_info->reason, rst_codes[rst_info->reason]);