🔥 Clean up arduino libs
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
#ifndef IPUtils_h
|
||||
#define IPUtils_h
|
||||
|
||||
/**
|
||||
* ESP32 SvelteKit
|
||||
*
|
||||
* A simple, secure and extensible framework for IoT projects for ESP32 platforms
|
||||
* with responsive Sveltekit front-end built with TailwindCSS and DaisyUI.
|
||||
* https://github.com/theelims/ESP32-sveltekit
|
||||
*
|
||||
* Copyright (C) 2018 - 2023 rjwats
|
||||
* Copyright (C) 2023 theelims
|
||||
*
|
||||
* All Rights Reserved. This software may be modified and distributed under
|
||||
* the terms of the LGPL v3 license. See the LICENSE file for details.
|
||||
**/
|
||||
|
||||
#include <IPAddress.h>
|
||||
|
||||
const IPAddress IP_NOT_SET = IPAddress(INADDR_NONE);
|
||||
|
||||
class IPUtils {
|
||||
public:
|
||||
static bool isSet(const IPAddress &ip) { return ip != IP_NOT_SET; }
|
||||
static bool isNotSet(const IPAddress &ip) { return ip == IP_NOT_SET; }
|
||||
};
|
||||
|
||||
#endif // end IPUtils_h
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef JsonUtils_h
|
||||
#define JsonUtils_h
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <utils/ip_utils.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <string>
|
||||
|
||||
@@ -11,22 +9,21 @@ class JsonUtils {
|
||||
static void readIP(const JsonVariant &root, const std::string &key, IPAddress &ip, const std::string &def) {
|
||||
IPAddress defaultIp = {};
|
||||
if (!defaultIp.fromString(def.c_str())) {
|
||||
defaultIp = INADDR_NONE;
|
||||
defaultIp = IPAddress(0, 0, 0, 0);
|
||||
}
|
||||
readIP(root, key, ip, defaultIp);
|
||||
}
|
||||
|
||||
static void readIP(const JsonVariant &root, const std::string &key, IPAddress &ip,
|
||||
const IPAddress &defaultIp = INADDR_NONE) {
|
||||
const IPAddress &defaultIp = IPAddress(0, 0, 0, 0)) {
|
||||
if (!root[key].is<std::string>() || !ip.fromString(root[key].as<std::string>().c_str())) {
|
||||
ip = defaultIp;
|
||||
}
|
||||
}
|
||||
|
||||
static void writeIP(JsonVariant &root, const std::string &key, const IPAddress &ip) {
|
||||
if (IPUtils::isSet(ip)) {
|
||||
if (ip != IPAddress(0, 0, 0, 0)) {
|
||||
root[key] = ip.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif // end JsonUtils
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef MATHUTILS_H
|
||||
#define MATHUTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <dspm_mult.h>
|
||||
#include <cmath>
|
||||
@@ -68,6 +67,4 @@ static constexpr float combinatorial_constexpr(const int n, int k) {
|
||||
result /= (i + 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef TIMING_H
|
||||
#define TIMING_H
|
||||
#pragma once
|
||||
|
||||
#include "esp_timer.h"
|
||||
|
||||
@@ -40,5 +39,3 @@
|
||||
name##_count = 0; \
|
||||
last_time = esp_timer_get_time() / 1000; \
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user