master
IoTcat 5 years ago
parent 0abf4f5f95
commit 58b3132f9b
  1. BIN
      .vscode/ipch/40f34ea280040acc/WEMOS_D1_MINI.ipch
  2. 10
      .vscode/settings.json
  3. BIN
      bin/core/core.a
  4. BIN
      bin/libraries/ESP8266HTTPUpdateServer/ESP8266HTTPUpdateServer.a
  5. BIN
      bin/libraries/ESP8266WebServer/ESP8266WebServer.a
  6. BIN
      bin/libraries/ESP8266WiFi/ESP8266WiFi.a
  7. 8
      bin/preproc/ctags_target_for_gcc_minus_e.cpp
  8. 8
      bin/sketch/wemos_D1_mini.ino.cpp
  9. BIN
      bin/sketch/wemos_D1_mini.ino.cpp.o
  10. 77
      bin/sketch/wiot.h
  11. BIN
      bin/wemos_D1_mini.ino.bin
  12. BIN
      bin/wemos_D1_mini.ino.elf
  13. 12446
      bin/wemos_D1_mini.ino.map
  14. 18
      client/wemos_D1_mini/ap.html
  15. 8
      client/wemos_D1_mini/wemos_D1_mini.ino
  16. 77
      client/wemos_D1_mini/wiot.h

@ -1,3 +1,11 @@
{
"C_Cpp.errorSquiggles": "Disabled"
"C_Cpp.errorSquiggles": "Disabled",
"background.customImages": "https://api.yimian.xyz/moe",
"todo-tree.tags": [
"TODO",
"FIXME",
"tag",
"done",
"note"
],
}

Binary file not shown.

@ -1,11 +1,17 @@
# 1 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino"
# 1 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino"
/*
* @Author: IoTcat (https://iotcat.me)
* @Date: 2019-05-02 22:17:45
* @Last Modified by:
* @Last Modified time: 2019-05-03 00:09:38
*/
# 7 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino" 2
# 13 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino" 2
// Create an instance of the server

@ -1,6 +1,12 @@
#include <Arduino.h>
#line 1 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino"
#line 1 "e:\\Arduino_project\\wIoT\\client\\wemos_D1_mini\\wemos_D1_mini.ino"
/*
* @Author: IoTcat (https://iotcat.me)
* @Date: 2019-05-02 22:17:45
* @Last Modified by:
* @Last Modified time: 2019-05-03 00:09:38
*/
#define WIFI_STA_SSID "yimian-iot"
#define WIFI_STA_PSK "1234567890."
@ -16,5 +22,3 @@

@ -1,3 +1,10 @@
/*
* @Author: IoTcat (https://iotcat.me)
* @Date: 2019-05-02 21:20:48
* @Last Modified by:
* @Last Modified time: 2019-05-03 00:12:37
*/
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
@ -18,11 +25,12 @@
const char* ssid = WIFI_STA_SSID;
const char* password = WIFI_STA_PSK;
const char* wiot_version = "v0.0.1";
enum ModeType{AP, STA};
ModeType Mode;
void(* resetFunc) (void) = 0;
//void(* resetFunc) (void) = 0;
/********** Web Server ***********/
ESP8266WebServer httpServer(WEB_PORT);
@ -30,7 +38,6 @@ ESP8266HTTPUpdateServer httpUpdater;
void serial_setup(){
Serial.begin(115200);
@ -45,6 +52,34 @@ void eeprom_setup(){
EEPROM.commit();
}
void eeprom_insertStr(int start, int end, const String& s){
Serial.println("Write");
const char *c = s.c_str();
int i, t;
for(i = 0; c[i] != '\0' && i < end - start - 1; i++){
t = *(c+i);
EEPROM.write(start + i, t);
Serial.println(t);
}
EEPROM.write(start + i, 0x00);
EEPROM.commit();
}
String eeprom_readStr(int start, int end){
Serial.println("Read");
int t[end-start];
int i;
for(i = 0; i < end - start - 1; i++){
t[i] = EEPROM.read(start + i);
Serial.println(t[i]);
}
t[i] = 0;
return "";
}
void wifi_setup(){
@ -72,12 +107,22 @@ void wifi_setup(){
void http_ap_root(){
String s = httpServer.arg("abc");
if(s == "reset") resetFunc();
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body>"+s+"</body></html>");
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body><h3>wIoT Client</h3><p>MAC Address: "+WiFi.macAddress()+"</p><p>wIoT Version: "+wiot_version+"</p><form action=\"/cmd\" method=\"get\"><p>Please Input the SSID of your WIFI:</p><input type=\"text\" name=\"ssid\"/><br/><p>Please Input the Password of your WIFI:</p><input type=\"text\" name=\"passwd\"/><br/><br/><input type=\"submit\" value=\"Submit\"/></form><p><font color=\"red\">You Only have ONE chance!! Please be Careful!!</font></p></body></html>");
}
void http_ap_cmd(){
String t_ssid = httpServer.arg("ssid");
String t_psk = httpServer.arg("passwd");
eeprom_insertStr(255, 355, t_ssid);
eeprom_insertStr(355, 455, t_psk);
String s = eeprom_readStr(255,270);
//if(s == "reset") ESP.restart();
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body>"+t_ssid+"||"+t_psk+"||"+s+"</body></html>");
}
void http_setup(){
if(Mode == STA){
@ -90,6 +135,7 @@ void http_setup(){
//MDNS.begin("wiot");
//MDNS.addService("http", "tcp", WEB_PORT);
httpServer.on("/", http_ap_root);
httpServer.on("/cmd", http_ap_cmd);
}
//httpserver begin
@ -101,20 +147,37 @@ void http_setup(){
int address = 4000;
int value = 55;
void setup() {
serial_setup();
wifi_setup();
http_setup();
}
void loop() {
httpServer.handleClient();/*
httpServer.handleClient();
EEPROM.write(address, 1+EEPROM.read(address));
value = EEPROM.read(address);
EEPROM.commit();
Serial.print(value,DEC);
Serial.print("\n");
delay(1000);
/*
EEPROM.write(0x01, 0x02);
static String res = "";
static String to = "";

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,18 @@
<html>
<head>
<title>wIoT Config</title>
</head>
<body>
<h3>wIoT Client</h3>
<p>MAC Address: </p>
<p>wIoT Version: </p>
<form action="/cmd" method="get">
<p>Please Input the SSID of your WIFI:</p>
<input type="text" name="ssid"/><br/>
<p>Please Input the Password of your WIFI:</p>
<input type="text" name="passwd"/><br/><br/>
<input type="submit" value="Submit"/>
</form>
<p><font color="red">You Only have ONE chance!! Please be Careful!!</font></p>
</body>
</html>

@ -1,3 +1,9 @@
/*
* @Author: IoTcat (https://iotcat.me)
* @Date: 2019-05-02 22:17:45
* @Last Modified by:
* @Last Modified time: 2019-05-03 00:20:51
*/
#define WIFI_STA_SSID "yimian-iot"
#define WIFI_STA_PSK "1234567890."
@ -12,5 +18,3 @@

@ -1,3 +1,10 @@
/*
* @Author: IoTcat (https://iotcat.me)
* @Date: 2019-05-02 21:20:48
* @Last Modified by:
* @Last Modified time: 2019-05-03 00:12:37
*/
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
@ -18,11 +25,12 @@
const char* ssid = WIFI_STA_SSID;
const char* password = WIFI_STA_PSK;
const char* wiot_version = "v0.0.1";
enum ModeType{AP, STA};
ModeType Mode;
void(* resetFunc) (void) = 0;
//void(* resetFunc) (void) = 0;
/********** Web Server ***********/
ESP8266WebServer httpServer(WEB_PORT);
@ -30,7 +38,6 @@ ESP8266HTTPUpdateServer httpUpdater;
void serial_setup(){
Serial.begin(115200);
@ -45,6 +52,34 @@ void eeprom_setup(){
EEPROM.commit();
}
void eeprom_insertStr(int start, int end, const String& s){
Serial.println("Write");
const char *c = s.c_str();
int i, t;
for(i = 0; c[i] != '\0' && i < end - start - 1; i++){
t = *(c+i);
EEPROM.write(start + i, t);
Serial.println(t);
}
EEPROM.write(start + i, 0x00);
EEPROM.commit();
}
String eeprom_readStr(int start, int end){
Serial.println("Read");
int t[end-start];
int i;
for(i = 0; i < end - start - 1; i++){
t[i] = EEPROM.read(start + i);
Serial.println(t[i]);
}
t[i] = 0;
return "";
}
void wifi_setup(){
@ -72,12 +107,22 @@ void wifi_setup(){
void http_ap_root(){
String s = httpServer.arg("abc");
if(s == "reset") resetFunc();
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body>"+s+"</body></html>");
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body><h3>wIoT Client</h3><p>MAC Address: "+WiFi.macAddress()+"</p><p>wIoT Version: "+wiot_version+"</p><form action=\"/cmd\" method=\"get\"><p>Please Input the SSID of your WIFI:</p><input type=\"text\" name=\"ssid\"/><br/><p>Please Input the Password of your WIFI:</p><input type=\"text\" name=\"passwd\"/><br/><br/><input type=\"submit\" value=\"Submit\"/></form><p><font color=\"red\">You Only have ONE chance!! Please be Careful!!</font></p></body></html>");
}
void http_ap_cmd(){
String t_ssid = httpServer.arg("ssid");
String t_psk = httpServer.arg("passwd");
eeprom_insertStr(255, 355, t_ssid);
eeprom_insertStr(355, 455, t_psk);
String s = eeprom_readStr(255,270);
//if(s == "reset") ESP.restart();
httpServer.send(200, "text/html", "<html><head><title>wIoT Config</title></head><body>"+t_ssid+"||"+t_psk+"||"+s+"</body></html>");
}
void http_setup(){
if(Mode == STA){
@ -90,6 +135,7 @@ void http_setup(){
//MDNS.begin("wiot");
//MDNS.addService("http", "tcp", WEB_PORT);
httpServer.on("/", http_ap_root);
httpServer.on("/cmd", http_ap_cmd);
}
//httpserver begin
@ -101,20 +147,37 @@ void http_setup(){
int address = 4000;
int value = 55;
void setup() {
serial_setup();
wifi_setup();
http_setup();
}
void loop() {
httpServer.handleClient();/*
httpServer.handleClient();
EEPROM.write(address, 1+EEPROM.read(address));
value = EEPROM.read(address);
EEPROM.commit();
Serial.print(value,DEC);
Serial.print("\n");
delay(1000);
/*
EEPROM.write(0x01, 0x02);
static String res = "";
static String to = "";

Loading…
Cancel
Save