32 broken

This commit is contained in:
Yuri Trikoz
2020-06-22 03:11:02 +03:00
parent 40688130fd
commit 092bec7dde
34 changed files with 1308 additions and 341 deletions

View File

@@ -0,0 +1,55 @@
#pragma once
#include <Arduino.h>
#include "FS.h"
#ifdef ESP32
#include "LITTLEFS.h"
#define LittleFS LITTLEFS
#endif
#ifdef ESP8266
#include <LittleFS.h>
#endif
class FileHelper {
public:
FileHelper(const String filename);
/*
* Проверить существование
*/
void exists();
/*
* Удалить файл
*/
void remove();
/*
* Открыть файл установить позицию @position
*/
File seek(size_t position = 0);
/*
* Чтение строки с содержащей @substr
*/
String readFileString(const String substr);
/*
* Добовление строки @str в файл
*/
String appendStr(const String str);
/*
* Запись строки
*/
String writeStr(const String);
/*
* Чтение в строку
*/
String readStr(size_t);
/*
* Размер в байтах
*/
size_t getSize();
};

View File

@@ -11,6 +11,7 @@
#ifdef ESP8266
#include <LittleFS.h>
#endif
/*
* Инициализация ФС
*/

View File

@@ -0,0 +1,32 @@
#pragma once
#include "Arduino.h"
#include "CommonTypes.h"
#include "Utils\StringUtils.h"
#include "Utils\TimeUtils.h"
#include "Errors.h"
#define pm PrintMessage(MODULE)
class PrintMessage {
public:
PrintMessage(const char* module) {
_module = module;
}
void error(const String str) {
print(EL_ERROR, str);
}
void info(const String str) {
print(EL_INFO, str);
}
private:
void print(const ErrorLevel_t level, const String& str) {
Serial.printf("%s [%s] [%s] %s\n", prettyMillis().c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
}
private:
const char* _module;
};

View File

@@ -2,6 +2,8 @@
#include <Arduino.h>
#include "CommonTypes.h"
uint8_t hexStringToUint8(String hex);
uint16_t hexStringToUint16(String hex);

View File

@@ -7,10 +7,6 @@
void Time_Init();
void time_check();
void reconfigTime();
/*
* Получение текущего времени
*/
@@ -22,7 +18,7 @@ String getTimeUnix();
/*
* Параметр время
* Результат выполнения
* @result результат
*/
boolean getUnixTimeStr(String&);
@@ -38,3 +34,9 @@ String getDateDigitalFormated();
int timeToMin(String Time);
const String prettyMillis(unsigned long time_ms = millis());
int timeZoneInSeconds(const byte timeZone);
bool hasTimeSynced();
int getBiasInSeconds();

10
include/Utils/WiFiUtils.h Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include "Global.h"
boolean scanWiFi(String ssid);
void startSTAMode();
bool startAPMode();