Rdzleo c63b35a0e7
Some checks failed
Build Boards / Determine variants to build (push) Successful in 6m26s
Build Boards / Build ${{ matrix.name }} (push) Failing after 6m43s
1、第一次提交项目,项目初始化;
2、修改了RP2040的代码,使其在没有安装摄像头的情况下也可以左右转动眼球和左右转动身体;
3、增加了一些中文注释的说明;
2026-04-09 14:22:24 +08:00

29 lines
792 B
C++

#ifndef SETTINGS_H
#define SETTINGS_H
#include <string>
#include <nvs_flash.h>
class Settings {
public:
Settings(const std::string& ns, bool read_write = false);
~Settings();
std::string GetString(const std::string& key, const std::string& default_value = "");
void SetString(const std::string& key, const std::string& value);
int32_t GetInt(const std::string& key, int32_t default_value = 0);
void SetInt(const std::string& key, int32_t value);
bool GetBool(const std::string& key, bool default_value = false);
void SetBool(const std::string& key, bool value);
void EraseKey(const std::string& key);
void EraseAll();
private:
std::string ns_;
nvs_handle_t nvs_handle_ = 0;
bool read_write_ = false;
bool dirty_ = false;
};
#endif