pull/56/merge
susanin-ivan 10 years ago
commit 27b6df98f0
  1. 12
      Makefile
  2. 10
      html/style.css
  3. 4
      html/ui.js
  4. 6
      include/espmissingincludes.h
  5. 2
      user/cgi.c
  6. 8
      user/user_main.c
  7. 12
      wiflash

@ -27,6 +27,10 @@ ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py)
ESPPORT ?= /dev/ttyUSB0
ESPBAUD ?= 460800
# Build time Wifi Cfg
# STA_SSID ?=
# STA_PASS ?=
# --------------- chipset configuration ---------------
# Pick your flash size: "512KB", "1MB", or "4MB"
@ -212,6 +216,14 @@ Q := @
vecho := @echo
endif
ifneq ($(strip $(STA_SSID)),)
CFLAGS+= -DSTA_SSID="$(STA_SSID)"
endif
ifneq ($(strip $(STA_PASS)),)
CFLAGS+= -DSTA_PASS="$(STA_PASS)"
endif
ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DGZIP_COMPRESSION
endif

@ -206,6 +206,16 @@ pre.console a {
color: #fff;
}
#menu .hostname {
width: 140px;
border-top: 1px solid #333;
height: 20px;
padding-left: 10px;
text-align: left;
color: #fff;
background: #9d1414;
}
#menu .pure-menu-heading {
font-size: 110%;
color: #fff;

@ -226,6 +226,7 @@ onLoad(function() {
<div class="pure-menu">\
<a class="pure-menu-heading" href="https://github.com/jeelabs/esp-link">\
<img src="/favicon.ico" height="32">&nbsp;esp-link</a>\
<div id="hostname" class="hostname"></div>\
<ul id="menu-list" class="pure-menu-list"></ul>\
</div>\
</div>\
@ -258,6 +259,9 @@ onLoad(function() {
v = $("#version");
if (v != null) { v.innerHTML = data.version; }
$("#hostname").innerHTML = data.hostname;
}, function() { setTimeout(getMenu, 1000); });
};
getMenu();

@ -37,6 +37,12 @@ void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg);
void ets_update_cpu_frequency(int freqmhz);
#ifdef SDK_DBG
#define DEBUG_SDK true
#else
#define DEBUG_SDK false
#endif
int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2)));

@ -66,7 +66,7 @@ int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) {
os_sprintf(buff,
"{\"menu\": [\"Home\", \"/home.html\", \"Wifi\", \"/wifi/wifi.html\","
"\"\xC2\xB5" "C Console\", \"/console.html\", \"Debug log\", \"/log.html\" ],\n"
" \"version\": \"%s\" }", esp_link_version);
" \"version\": \"%s\", \"hostname\": \"%s\"}", esp_link_version, wifi_station_get_hostname());
httpdSend(connData, buff, -1);
return HTTPD_CGI_DONE;
}

@ -105,6 +105,14 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) {
#endif
void user_rf_pre_init(void) {
system_set_os_print(DEBUG_SDK);
#if defined(STA_SSID) && defined(STA_PASS)
struct station_config stconf;
os_strncpy((char*)stconf.ssid, VERS_STR(STA_SSID), 32);
os_strncpy((char*)stconf.password, VERS_STR(STA_PASS), 64);
stconf.bssid_set = 0;
wifi_station_set_config_current(&stconf);
#endif
}
// address of espfs binary blob

@ -25,6 +25,8 @@ Example: ${0##*/} -v esp8266 firmware/user1.bin firmware/user2.bin
EOT
}
[ -z "$DEBUG" ] || set -x
if ! which curl >/dev/null; then
echo "ERROR: Cannot find curl: it is required for this script." >&2
exit 1
@ -56,6 +58,8 @@ fi
hostname=$1
user1=$2
user2=$3
test -n "$AUTH" && PASSADD="-u $AUTH"
re='[-A-Za-z0-9.]+'
if [[ ! "$hostname" =~ $re ]]; then
@ -79,7 +83,7 @@ fw=
while true; do
[[ -n "$verbose" ]] && echo "Fetching http://$hostname/flash/next" >&2
v=; [[ -n "$verbose" ]] && v=-v
next=`curl -m 10 $v -s "http://$hostname/flash/next"`
next=`curl -m 10 $v $PASSADD -s "http://$hostname/flash/next"`
if [[ $? != 0 ]]; then
echo "Error retrieving http://$hostname/flash/next" >&2
exit 1
@ -102,7 +106,7 @@ done
#silent=-s
[[ -n "$verbose" ]] && silent=
res=`curl $silent -XPOST --data-binary "@$fw" "http://$hostname/flash/upload"`
res=`curl $silent $PASSADD -XPOST --data-binary "@$fw" "http://$hostname/flash/upload"`
if [[ $? != 0 ]]; then
echo "Error flashing $fw" >&2
exit 1
@ -110,13 +114,13 @@ fi
sleep 2
echo "Rebooting into new firmware" >&2
curl -m 10 -s "http://$hostname/flash/reboot"
curl -m 10 $PASSADD -s "http://$hostname/flash/reboot"
sleep 2
echo "Waiting for ESP8266 to come back"
while true; do
[[ -n "$verbose" ]] && echo "Fetching http://$hostname/flash/next" >&2
next2=`curl -m 10 $v -s "http://$hostname/flash/next"`
next2=`curl -m 10 $v $PASSADD -s "http://$hostname/flash/next"`
[[ -n "$verbose" ]] && echo "got: $next2"
re='user[12]\.bin'
if [[ "$next2" =~ $re ]]; then

Loading…
Cancel
Save