15#include "FreeRTOSConfig.h"
26 .
name =
"System Commands" ,
64#if configUSE_STATS_FORMATTING_FUNCTIONS> 0
92 replies.emplace_back(this->getCsvHelpstring());
94 std::string itfHelp =
"";
95 if(cmd.originalInterface){
96 itfHelp = cmd.originalInterface->getHelpstring() +
"\n";
98 std::string reply = itfHelp +
"Available classes (use cls.0.help for more info):\n";
102 reply += std::string(
info->clsname) +
"." + std::to_string(
info->instance)+
"\n";
104 reply +=
"\n"+this->getCommandsHelpstring();
105 replies.emplace_back(reply);
113 handler->saveFlash();
130 replies.emplace_back(
getIntV());
139 replies.emplace_back(
getExtV());
148 replies.emplace_back(buf);
151 Flash_Write(ADR_CURRENT_CONFIG, (uint16_t)cmd.val);
161 replyErrors(replies);
165 replyFlashDump(replies);
180 replies.push_back(reply);
198 replies.push_back(reply);
204 replies.emplace_back(HW_TYPE,HW_TYPE_INT);
210 replies.emplace_back(HAL_GetDEVID(),HAL_GetREVID());
221 reply.
reply +=
"Usage: ";
222 reply.
reply += std::to_string(
info.uordblks);
223 reply.
reply +=
" Size: ";
224 reply.
reply +=std::to_string(
info.arena);
226 replies.push_back(reply);
232 replies.emplace_back(xPortGetFreeHeapSize(),xPortGetMinimumEverFreeHeapSize());
235#if configUSE_STATS_FORMATTING_FUNCTIONS>0
239 vTaskGetRunTimeStats(repl);
240 replies.emplace_back(
"\n"+std::string(repl));
255 replies.push_back(reply);
273 replies.emplace_back((uint64_t)HAL_GetUIDw0() | (uint64_t)HAL_GetUIDw1() << 32,HAL_GetUIDw2());
276 replies.emplace_back(HAL_GetUIDw0());
277 }
else if(cmd.adr == 1){
278 replies.emplace_back(HAL_GetUIDw1());
279 }
else if(cmd.adr == 2){
280 replies.emplace_back(HAL_GetUIDw2());
302 std::vector<std::tuple<uint16_t,uint16_t>> result;
305 for(
auto entry : result){
309 std::tie(
adr,val) = entry;
314 replies.push_back(reply);
325 reply.
reply +=
"None";
327 replies.push_back(reply);
333 reply.
reply += error.toString() +
"\n";
334 reply.
val = (uint32_t)error.code;
336 replies.push_back(reply);
__attribute__((optimize("-O1"))) CommandStatus SystemCommands
ClassChooser< FFBoardMain > mainchooser
uint16_t getSelectionID()
void registerCommand(const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
virtual CommandStatus internalCommand(const ParsedCommand &cmd, std::vector< CommandReply > &replies)
static std::vector< CommandHandler * > & getCommandHandlers()
static std::span< Error > getErrors()
virtual const ClassIdentifier getInfo()
static std::vector< PersistentStorage * > & getFlashHandlers()
static SystemCommands * systemCommandsInstance
static ClassIdentifier info
virtual ~SystemCommands()
static bool errorPrintingEnabled
static void replyErrors(std::vector< CommandReply > &replies)
static void replyFlashDump(std::vector< CommandReply > &replies)
const ClassIdentifier getInfo()
Command handlers always have class infos. Works well with ChoosableClass.
static const uint8_t SW_VERSION_INT[3]
void Flash_Dump(std::vector< std::tuple< uint16_t, uint16_t > > *result, bool includeAll=false)
bool Flash_Write(uint16_t adr, uint16_t dat)
bool Flash_Read(uint16_t adr, uint16_t *buf, bool checkempty=true)
uint16_t commandHandlerID