43 lines
1.8 KiB
C
43 lines
1.8 KiB
C
//
|
|
// Created by zemon on 15.11.22.
|
|
//
|
|
#include "CliCmd/Vars.h"
|
|
#include "stream.h"
|
|
|
|
int32_t vGetVarsTableSetting(tVariablesTable *extTable, tCliCmd *cli) {
|
|
|
|
for (uint16_t id = 0; id < extTable->count; ++id) {
|
|
CliCmd_Print(cli, extTable->items[id].name.str, extTable->items[id].name.length);
|
|
CliCmd_PrintStatic(cli, " ");
|
|
tVariableDescriptor *descriptor = extTable->items + id;
|
|
|
|
if (descriptor->typeId == VARIABLE_TYPE_STRING) {
|
|
CliCmd_Print(cli, descriptor->addr, *(uint8_t *) descriptor->len);
|
|
} else {
|
|
if (extTable->items[id].typeId == VARIABLE_TYPE_UINT8) {
|
|
debug_printf(cli->serialCommandPort, "%u", *(uint8_t *) extTable->items[id].addr);
|
|
}
|
|
if (extTable->items[id].typeId == VARIABLE_TYPE_UINT16) {
|
|
debug_printf(cli->serialCommandPort, "%u", *(uint16_t *) extTable->items[id].addr);
|
|
}
|
|
if (extTable->items[id].typeId == VARIABLE_TYPE_UINT32) {
|
|
debug_printf(cli->serialCommandPort, "%u", *(uint8_t *) extTable->items[id].addr);
|
|
}
|
|
if (extTable->items[id].typeId == VARIABLE_TYPE_BOOL) {
|
|
debug_printf(cli->serialCommandPort, "%u", *(uint8_t *) extTable->items[id].addr);
|
|
}
|
|
if (extTable->items[id].typeId == VARIABLE_TYPE_FLOAT32) {
|
|
debug_printf(cli->serialCommandPort, "%f", *(float *) extTable->items[id].addr);
|
|
}
|
|
if (!VariablesTable_IsVariableChangeAllowed(descriptor)) {
|
|
CliCmd_PrintStatic(cli, " === CHANGE NOT ACCESS ===");
|
|
}
|
|
}
|
|
CliCmd_PrintLnStatic(cli, "");
|
|
}
|
|
|
|
CliCmd_PrintLnStatic(cli, "================================================");
|
|
CliCmd_PrintLnStatic(cli, "");
|
|
|
|
return 0;
|
|
} |