Fixed WiFi cgi stuff. Also: cleaned up everything so it compiles without warnings. include/espmissingincludes.h adds the missing protoypes for that.
parent
dc48a35f86
commit
febf58df6e
@ -0,0 +1,2 @@ |
|||||||
|
var t=function(a,b){return function(c,d){return a.replace(/#{([^}]*)}/g,function(a,f){return Function("x","with(x)return "+f).call(c,d||b||{})})}},s=function(a,b){return b?{get:function(c){return a[c]&&b.parse(a[c])},set:function(c,d){a[c]=b.stringify(d)}}:{}}(this.localStorage||{},JSON),p=function(a,b,c,d){c=c||document;d=c[b="on"+b];a=c[b]=function(e){d=d&&d(e=e||c.event);return(a=a&&b(e))?b:d};c=this},m=function(a,b,c){b=document;c=b.createElement("p");c.innerHTML=a;for(a=b.createDocumentFragment();b= |
||||||
|
c.firstChild;)a.appendChild(b);return a},$=function(a,b){a=a.match(/^(\W)?(.*)/);return(b||document)["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2])},j=function(a){for(a=0;a<4;a++)try{return a?new ActiveXObject([,"Msxml2","Msxml3","Microsoft"][a]+".XMLHTTP"):new XMLHttpRequest}catch(b){}}; |
@ -0,0 +1,7 @@ |
|||||||
|
<html> |
||||||
|
<head><title>Connecting</title></head> |
||||||
|
<META HTTP-EQUIV="refresh" CONTENT="3;URL=wifi.tpl"> |
||||||
|
<body> |
||||||
|
Connecting to AP now... |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,74 @@ |
|||||||
|
<html><head><title>WiFi connection</title> |
||||||
|
<script type="text/javascript" src="140medley.min.js"></script> |
||||||
|
<script type="text/javascript"> |
||||||
|
|
||||||
|
var xhr=j(); |
||||||
|
var currAp="%currSsid%"; |
||||||
|
|
||||||
|
function createInputForAp(ap) { |
||||||
|
if (ap.essid=="" && ap.rssi==0) return; |
||||||
|
var div=document.createElement("div"); |
||||||
|
div.id="apdiv"; |
||||||
|
var input=document.createElement("input"); |
||||||
|
input.type="radio"; |
||||||
|
input.name="essid"; |
||||||
|
input.value=ap.essid; |
||||||
|
if (currAp==ap.essid) input.checked="1"; |
||||||
|
input.id="opt-"+ap.essid; |
||||||
|
var label=document.createElement("label"); |
||||||
|
label.htmlFor="opt-"+ap.essid; |
||||||
|
label.textContent=ap.essid+" (rssi "+ap.rssi+")"; |
||||||
|
div.appendChild(input); |
||||||
|
div.appendChild(label); |
||||||
|
return div; |
||||||
|
} |
||||||
|
|
||||||
|
function getSelectedEssid() { |
||||||
|
var e=document.forms.wifiform.elements; |
||||||
|
for (var i=0; i<e.length; i++) { |
||||||
|
if (e[i].type=="radio" && e[i].checked) return e[i].value; |
||||||
|
} |
||||||
|
return currAp; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function scanAPs() { |
||||||
|
xhr.open("GET", "wifiscan.cgi"); |
||||||
|
xhr.onreadystatechange=function() { |
||||||
|
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) { |
||||||
|
var data=JSON.parse(xhr.responseText); |
||||||
|
currAp=getSelectedEssid(); |
||||||
|
if (data.result.inProgress=="0" && data.result.APs.length>1) { |
||||||
|
$("#aps").innerHTML=""; |
||||||
|
for (var i=0; i<data.result.APs.length; i++) { |
||||||
|
if (data.result.APs[i].essid=="" && data.result.APs[i].rssi==0) continue; |
||||||
|
$("#aps").appendChild(createInputForAp(data.result.APs[i])); |
||||||
|
} |
||||||
|
window.setTimeout(scanAPs, 20000); |
||||||
|
} else { |
||||||
|
window.setTimeout(scanAPs, 1000); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
xhr.send(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
window.onload=function(e) { |
||||||
|
scanAPs(); |
||||||
|
}; |
||||||
|
</script> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<p> |
||||||
|
Current WiFi mode: %WiFiMode% |
||||||
|
</p> |
||||||
|
<form name="wifiform" action="connect.cgi" method="post"> |
||||||
|
<p> |
||||||
|
To connect to a WiFi network, please select one of the detected networks...<br> |
||||||
|
<div id="aps">Scanning...</div> |
||||||
|
<br> |
||||||
|
WiFi password, if applicable: <br /> |
||||||
|
<input type="text" name="passwd" val="%WiFiPasswd%"> <br /> |
||||||
|
<input type="submit" name="connect" value="Connect!"> |
||||||
|
</p> |
@ -0,0 +1,35 @@ |
|||||||
|
#ifndef ESPMISSINGINCLUIDES_H |
||||||
|
#define ESPMISSINGINCLUIDES_H |
||||||
|
|
||||||
|
#include <ets_sys.h> |
||||||
|
|
||||||
|
//Missing function prototypes in include folders. Gcc will warn on these if we don't define 'em anywhere.
|
||||||
|
//MOST OF THESE ARE GUESSED! but they seem to swork and shut up the compiler.
|
||||||
|
void ets_isr_attach(int routine, void* something, void *buff); |
||||||
|
void uart_div_modify(int no, int div); |
||||||
|
void ets_isr_unmask(int something); |
||||||
|
void ets_install_putc1(void* routine); |
||||||
|
void *pvPortMalloc(size_t xWantedSize); |
||||||
|
void pvPortFree(void *ptr); |
||||||
|
void *vPortMalloc(size_t xWantedSize); |
||||||
|
void vPortFree(void *ptr); |
||||||
|
void *ets_memcpy(void *dest, const void *src, size_t n); |
||||||
|
void *ets_memset(void *s, int c, size_t n); |
||||||
|
void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer); |
||||||
|
void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg); |
||||||
|
void ets_timer_disarm(ETSTimer *a); |
||||||
|
int atoi(const char *nptr); |
||||||
|
int ets_strncmp(const char *s1, const char *s2, int len); |
||||||
|
int ets_strcmp(const char *s1, const char *s2); |
||||||
|
int ets_strlen(const char *s); |
||||||
|
char *ets_strcpy(char *dest, const char *src); |
||||||
|
char *ets_strncpy(char *dest, const char *src, size_t n); |
||||||
|
char *ets_strstr(const char *haystack, const char *needle); |
||||||
|
int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
||||||
|
int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
||||||
|
void uart_div_modify(int no, int freq); |
||||||
|
void ets_isr_unmask(int intr); |
||||||
|
void ets_install_putc1(void *routine); |
||||||
|
void ets_isr_attach(int intr, void *handler, void *arg); |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,8 @@ |
|||||||
|
|
||||||
|
//Including the system-wide stdint.h messes stuff up... but I don't want to change heatshrink
|
||||||
|
//not to do it. Including this dummy file fixes it too, tho'.
|
||||||
|
|
||||||
|
#ifndef __ets__ |
||||||
|
//Do include stdint for testing builds.
|
||||||
|
#include_next <stdint.h> |
||||||
|
#endif |
Loading…
Reference in new issue