47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#ifndef STORAGE_H
|
|
#define STORAGE_H
|
|
|
|
#include <Arduino.h>
|
|
#include "consts.h"
|
|
|
|
#if STORAGE_ENABLE
|
|
#include <SPIFFS.h>
|
|
#endif
|
|
|
|
class Storage
|
|
{
|
|
public:
|
|
static bool isMounted;
|
|
static void init();
|
|
|
|
// 默认参数定义
|
|
static constexpr uint8_t DEFAULT_BASE_SPEED = 50;
|
|
static constexpr uint8_t DEFAULT_TURN_SPEED = 50;
|
|
static constexpr uint8_t DEFAULT_ROTATE_SENSITIVE = 3;
|
|
static constexpr unsigned int DEFAULT_SENSITIVITY = 0xFF;
|
|
static constexpr float DEFAULT_KP = 1.0f;
|
|
static constexpr float DEFAULT_KI = 0.0f;
|
|
static constexpr float DEFAULT_KD = 0.0f;
|
|
|
|
// 当前参数(用于非存储模式)
|
|
static uint8_t currentBaseSpeed;
|
|
static uint8_t currentTurnSpeed;
|
|
static uint8_t currentRotateSensitive;
|
|
static unsigned int currentSensitivity;
|
|
static float currentKp;
|
|
static float currentKi;
|
|
static float currentKd;
|
|
static String currentName;
|
|
|
|
static void setPID(float kp, float ki, float kd);
|
|
static void getPID(float &kp, float &ki, float &kd);
|
|
static void setSensitivity(unsigned int sensitivity);
|
|
static unsigned int getSensitivity();
|
|
static void setName(String name);
|
|
static String getName();
|
|
static void setTrackingParams(uint8_t baseSpeed, uint8_t turnSpeed, uint8_t rotateSensitive);
|
|
static void getTrackingParams(uint8_t &baseSpeed, uint8_t &turnSpeed, uint8_t &rotateSensitive);
|
|
};
|
|
|
|
#endif
|