Lint for config

This commit is contained in:
Magnus Persson 2022-01-06 22:20:23 +01:00
parent 5d9115137f
commit 88bd971b73
2 changed files with 546 additions and 546 deletions

View File

@ -21,8 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "config.h"
#include "helper.h"
#include "src/config.h"
#include "src/helper.h"
#include <LittleFS.h>
Config myConfig;
@ -33,9 +33,9 @@ Config myConfig;
Config::Config() {
// Assiging default values
char buf[30];
sprintf(&buf[0], "%6x", (unsigned int) ESP.getChipId() );
snprintf(&buf[0], sizeof(buf) "%6x", (unsigned int) ESP.getChipId());
id = String(&buf[0]);
sprintf(&buf[0], "" WIFI_MDNS "%s", getID() );
snprintf(&buf[0], sizeof(buf), "" WIFI_MDNS "%s", getID());
mDNS = String(&buf[0]);
#if LOG_LEVEL == 6 && !defined( CFG_DISABLE_LOGGING )

View File

@ -21,14 +21,14 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef SRC_CONFIG_H_
#define SRC_CONFIG_H_
// Includes
#include "helper.h"
#include <stdlib.h>
#include "src/helper.h"
#include <Arduino.h>
#include <ArduinoJson.h>
#include <stdlib.h>
// defintions
#define CFG_JSON_BUFSIZE 3192
@ -141,7 +141,7 @@ class Config {
public:
Config();
const char* getID() { return id.c_str(); };
const char* getID() { return id.c_str(); }
const char* getMDNS() { return mDNS.c_str(); }
void setMDNS(String s) { mDNS = s; saveNeeded = true; }
@ -185,8 +185,8 @@ class Config {
char getTempFormat() { return tempFormat; }
void setTempFormat(char c) { tempFormat = c; saveNeeded = true; }
bool isTempC() { return tempFormat=='C'?false:true; };
bool isTempF() { return tempFormat=='F'?false:true; };
bool isTempC() { return tempFormat == 'C' ? false : true; }
bool isTempF() { return tempFormat == 'F' ? false : true; }
float getVoltageFactor() { return voltageFactor; }
void setVoltageFactor(float f) { voltageFactor = f; saveNeeded = true; }
@ -204,8 +204,8 @@ class Config {
char getGravityFormat() { return gravityFormat; }
void setGravityFormat(char c) { gravityFormat = c; saveNeeded = true; }
bool isGravitySG() { return gravityFormat=='G'?false:true; };
bool isGravityPlato() { return gravityFormat=='P'?false:true; };
bool isGravitySG() { return gravityFormat == 'G' ? false : true; }
bool isGravityPlato() { return gravityFormat == 'P' ? false : true; }
const RawGyroData& getGyroCalibration() { return gyroCalibration; }
void setGyroCalibration(const RawGyroData &r) { gyroCalibration = r; saveNeeded = true; }
@ -218,13 +218,13 @@ class Config {
bool saveFile();
bool loadFile();
void checkFileSystem();
bool isSaveNeeded() { return saveNeeded; };
void setSaveNeeded() { saveNeeded = true; };
bool isSaveNeeded() { return saveNeeded; }
void setSaveNeeded() { saveNeeded = true; }
};
// Global instance created
extern Config myConfig;
#endif // _CONFIG_H
#endif // SRC_CONFIG_H_
// EOF