Compare commits
No commits in common. "e8329f258710ff14f75ceb9867ccf7cfe320a3c4" and "b47f778fc12eb9cf60795bb686f7115b3ed507e0" have entirely different histories.
e8329f2587
...
b47f778fc1
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -48,6 +48,5 @@
|
|||||||
"streambuf": "cpp",
|
"streambuf": "cpp",
|
||||||
"cinttypes": "cpp",
|
"cinttypes": "cpp",
|
||||||
"typeinfo": "cpp"
|
"typeinfo": "cpp"
|
||||||
},
|
}
|
||||||
"python.pythonPath": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
|
|
||||||
}
|
}
|
Binary file not shown.
@ -1,15 +1,16 @@
|
|||||||
#pragma once
|
#ifndef __FILESYS_H
|
||||||
|
#define __FILESYS_H
|
||||||
|
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
|
|
||||||
bool mount_fs();
|
bool mount_fs();
|
||||||
bool format_fs();
|
bool format_fs();
|
||||||
|
|
||||||
File open(const char * path);
|
|
||||||
|
|
||||||
void ls(const char * dirname);
|
void ls(const char * dirname);
|
||||||
void printFile(const char * path);
|
void readFile(const char * path);
|
||||||
void writeFile(const char * path, const char * message);
|
void writeFile(const char * path, const char * message);
|
||||||
void appendFile(const char * path, const char * message);
|
void appendFile(const char * path, const char * message);
|
||||||
void renameFile(const char * path1, const char * path2);
|
void renameFile(const char * path1, const char * path2);
|
||||||
void deleteFile(const char * path);
|
void deleteFile(const char * path);
|
||||||
|
|
||||||
|
#endif // __FILESYS_H
|
@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#ifndef __HTTPSERVER_H
|
||||||
|
#define __HTTPSERVER_H
|
||||||
|
|
||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
|
|
||||||
|
|
||||||
class HTTPServer : public ESP8266WebServer {
|
class HTTPServer : public ESP8266WebServer {
|
||||||
private:
|
private:
|
||||||
const char* rootDir;
|
const char* rootDir;
|
||||||
@ -33,20 +35,6 @@ public:
|
|||||||
this->listRoot();
|
this->listRoot();
|
||||||
Serial.printf("\n\r");
|
Serial.printf("\n\r");
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11
|
|
||||||
on("/compress.html", [this]() {
|
|
||||||
File f = open("/compress.html.gz");
|
|
||||||
if (!f) {
|
|
||||||
Serial.println("Failed to open file for reading");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Serial.println("Streaming /compress.html.gz to client");
|
|
||||||
const String cont = "text/html";
|
|
||||||
streamFile(f, cont);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if( this->addRootFileHandler() ){
|
if( this->addRootFileHandler() ){
|
||||||
this->begin();
|
this->begin();
|
||||||
Serial.printf("[HTTPServer] Server active on Port 80 !\n\r");
|
Serial.printf("[HTTPServer] Server active on Port 80 !\n\r");
|
||||||
@ -56,3 +44,5 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // __HTTPSERVER_H
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#ifndef __OTA_H
|
||||||
|
#define __OTA_H
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
@ -46,3 +47,6 @@ void ota_setup() {
|
|||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __OTA_H
|
@ -4,7 +4,7 @@
|
|||||||
// deleteFile("/hello.txt");
|
// deleteFile("/hello.txt");
|
||||||
// writeFile("/hello.txt", "Hello ");
|
// writeFile("/hello.txt", "Hello ");
|
||||||
// appendFile("/hello.txt", "World!\n\r");
|
// appendFile("/hello.txt", "World!\n\r");
|
||||||
// printFile("/hello.txt");
|
// readFile("/hello.txt");
|
||||||
// listDir("/");
|
// listDir("/");
|
||||||
|
|
||||||
FSInfo fsinfo;
|
FSInfo fsinfo;
|
||||||
@ -58,12 +58,7 @@ void ls(const char * dirname) {
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
File open(const char * path) {
|
void readFile(const char * path) {
|
||||||
return LittleFS.open(path, "r");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void printFile(const char * path) {
|
|
||||||
Serial.printf("Reading file: %s\n\r", path);
|
Serial.printf("Reading file: %s\n\r", path);
|
||||||
|
|
||||||
File file = LittleFS.open(path, "r");
|
File file = LittleFS.open(path, "r");
|
@ -9,8 +9,8 @@ extern "C" {
|
|||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
}
|
}
|
||||||
// OTA & WEB
|
// OTA & WEB
|
||||||
#include "wifi_credentials.h"
|
|
||||||
#include "ota.h"
|
#include "ota.h"
|
||||||
|
#include "wifi_credentials.h"
|
||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
|
|
||||||
// BOARD
|
// BOARD
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// #include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "treppe.h"
|
#include "treppe.h"
|
||||||
|
|
||||||
#include <unity.h>
|
#include <unity.h>
|
||||||
|
|
||||||
Treppe stairs(10);
|
Treppe stairs(10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user