Skip to content

Commit

Permalink
Merge pull request #1 from esp8266/esp8266
Browse files Browse the repository at this point in the history
pull changes from master
  • Loading branch information
ficeto committed May 1, 2015
2 parents 1da4b20 + f7209e3 commit 6157495
Show file tree
Hide file tree
Showing 6 changed files with 312 additions and 291 deletions.
4 changes: 2 additions & 2 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -784,12 +784,12 @@
</target>

<target name="download-launch4j-windows">
<get src="http://switch.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-win32.zip" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<get src="http://heanet.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-win32.zip" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<unzip dest="windows/launcher/" src="windows/launch4j-3.0.2-win32.zip" overwrite="true"/>
</target>

<target name="download-launch4j-linux">
<get src="http://switch.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-linux.tgz" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<get src="http://heanet.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-linux.tgz" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />

<exec executable="tar" dir="windows/launcher">
<arg value="-xf"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,15 @@ extern void __detachInterrupt(uint8_t pin) {
}

void initPins() {
ETS_GPIO_INTR_ATTACH(interrupt_handlers, &interrupt_reg);
for (int i = 0; i <= 5; ++i) {
pinMode(i, INPUT);
}
// pins 6-11 are used for the SPI flash interface
for (int i = 12; i <= 16; ++i) {
pinMode(i, INPUT);
}

ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
ETS_GPIO_INTR_ENABLE();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,23 @@ MDNSResponder mdns;

ESP8266WebServer server(80);

void handle_root() {
void handleRoot() {
server.send(200, "text/plain", "hello from esp8266!");
}

bool handle_not_found(){
void handleNotFound(){
String message = "URI: ";
message += server.uri();
message += "\nMethod: ";
message += (server.method() == HTTP_GET)?"GET":"POST";
message += "\nNot Found!\n\n";
message += "\nArguments: ";
message += server.args();
message += "\n";
for (uint8_t i=0; i<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
message += "\nNotFound!";
server.send(404, "text/plain", message);
return true;
}

void setup(void){
Expand All @@ -45,15 +44,17 @@ void setup(void){
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

if (mdns.begin("esp8266", WiFi.localIP())) Serial.println("MDNS responder started");
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}

server.on("/", handle_root);
server.on("/", handleRoot);

server.on("/inline", [](){
server.send(200, "text/plain", "this works as well");
});

server.onNotFound(handle_not_found);
server.onNotFound(handleNotFound);

server.begin();
Serial.println("HTTP server started");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ method KEYWORD2
client KEYWORD2
send KEYWORD2
arg KEYWORD2
argName KEYWORD2
args KEYWORD2
hasArg KEYWORD2
onNotFound KEYWORD2

#######################################
# Constants (LITERAL1)
Expand Down
Loading

0 comments on commit 6157495

Please sign in to comment.