Fix for ESP8266mod

This commit is contained in:
Goat 2018-09-17 15:09:57 +02:00
parent d7297969a9
commit eae459a1b4
2 changed files with 522 additions and 537 deletions

View file

@ -1,5 +1,4 @@
//#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
//#include <WiFiClient.h>
#include <DNSServer.h> #include <DNSServer.h>
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#include "gadgety.h" #include "gadgety.h"
@ -12,7 +11,7 @@ using namespace std;
#define TIMESTEPS 80000 // 1 millisecond #define TIMESTEPS 80000 // 1 millisecond
#define LINES_NUM 4 #define LINES_NUM 4
const unsigned LINE_PIN_MAP[] = { 2, 12, 13, 14 }; const unsigned LINE_PIN_MAP[] = { 13, 14, 12, 16 };
typedef unsigned int line_time_t; typedef unsigned int line_time_t;
@ -94,7 +93,7 @@ line_time_t new_cursor;
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
ESP8266WebServer server(80); //Server on port 80 ESP8266WebServer server(80); //Server on port 80
IPAddress myIP = WiFi.softAPIP(); //Get IP address IPAddress myIP; //Get IP address
DNSServer dnsServer; DNSServer dnsServer;
void serve_play(void) void serve_play(void)
@ -150,22 +149,24 @@ void setup()
// Start sequencer // Start sequencer
sequencer_init(); sequencer_init();
noInterrupts();
timer0_isr_init();
timer0_attachInterrupt(sequencer_main_loop);
timer0_write(ESP.getCycleCount() + TIMESTEPS);
interrupts();
// SPIFFS.begin(); // SPIFFS.begin();
Serial.begin(115200); Serial.begin(115200);
WiFi.mode(WIFI_AP); //Only Access point
//WiFi.mode(WIFI_AP); //Only Access point
WiFi.softAP("Gadgety", "gadgety123"); //Start HOTspot removing password will disable security WiFi.softAP("Gadgety", "gadgety123"); //Start HOTspot removing password will disable security
myIP = WiFi.softAPIP(); //Get IP address
server.begin(); server.begin();
gadgety_static_init_server(&server); gadgety_static_init_server(&server);
server.on("/play.ws", serve_play); server.on("/play.ws", serve_play);
dnsServer.start(DNS_PORT, "gadgety.com", myIP); dnsServer.start(DNS_PORT, "gadgety.com", myIP);
noInterrupts();
timer0_isr_init();
timer0_attachInterrupt(sequencer_main_loop);
timer0_write(ESP.getCycleCount() + TIMESTEPS);
interrupts();
} }
void loop() { void loop() {
@ -176,10 +177,4 @@ void loop() {
} else if (server.arg(1)=="0") { } else if (server.arg(1)=="0") {
Serial.print("Spento"); Serial.print("Spento");
} }
} }
// void handleRoot() {
// server.send (200, "text/html", index.html);
// }

File diff suppressed because it is too large Load diff