This commit is contained in:
2026-01-08 07:56:53 +01:00
parent 3b2ec32532
commit 47b4a51ca2
3 changed files with 22 additions and 23 deletions

View File

File diff suppressed because one or more lines are too long

View File

@@ -492,22 +492,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
}
}
/* ---------------- Neighbors ---------------- */
else if (STR_EQ_LIT (cmd, "neighbors")) {
Callbacks_FormatNeighborsReply ((char *)reply);
} else if (STR_EQ_LIT (cmd, "neighbor.remove ")) {
const char *hex = cmd + 16;
uint8_t pubkey[PUB_KEY_SIZE];
int len = strlen (hex) / 2;
if (mesh_fromHex (pubkey, len, hex)) {
Callbacks_RemoveNeighbor (pubkey, len);
strcpy ((char *)reply, "OK");
} else {
strcpy ((char *)reply, "ERR: bad pubkey");
}
}
/* ---------------- Radio / Temp ---------------- */
/*
else if (STR_EQ_LIT (cmd, "tempradio ")) {
char tmp[64];
strcpy (tmp, &cmd[10]);
@@ -529,6 +514,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
strcpy ((char *)reply, "Error, invalid params");
}
}
*/
/* ---------------- Password ---------------- */
else if (STR_EQ_LIT (cmd, "password ")) {
@@ -543,6 +529,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
if (memcmp (config, "af", 2) == 0) {
sprintf (reply, "> %f", persistent.airtimeFactor);
/*
} else if (memcmp (config, "int.thresh", 10) == 0) {
sprintf (reply, "> %d", (uint32_t)_prefs->interference_threshold);
} else if (memcmp (config, "agc.reset.interval", 18) == 0) {
@@ -554,7 +541,8 @@ void processCommand (char *cmd, NodeEntry *remNode) {
} else if (memcmp (config, "flood.advert.interval", 21) == 0) {
sprintf (reply, "> %d", (uint32_t)_prefs->flood_advert_interval);
} else if (memcmp (config, "advert.interval", 15) == 0) {
sprintf (reply, "> %d", ((uint32_t)_prefs->advert_interval) * 2);
sprintf (reply, "> %d", ((uint32_t)_prefs->advert_interval) * 2);1
*/
} else if (memcmp (config, "guest.password", 14) == 0) {
sprintf (reply, "> %s", persistent.guestPassword);
} else if (memcmp (config, "name", 4) == 0) {
@@ -565,6 +553,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
sprintf (reply, "> %d", persistent.latitude);
} else if (memcmp (config, "lon", 3) == 0) {
sprintf (reply, "> %d", persistent.longitude);
/*
} else if (memcmp (config, "radio", 5) == 0) {
char freq[16], bw[16];
snprintf(freq, sizeof(freq), "%lf", persistent.frequencyInHz / 1000000.0);
@@ -582,6 +571,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
sprintf (reply, "> %d", (uint32_t)_prefs->tx_power_dbm);
} else if (memcmp (config, "freq", 4) == 0) {
sprintf (reply, "> %s", StrHelper::ftoa (_prefs->freq));
*/
} else if (memcmp (config, "public.key", 10) == 0) {
strcpy (reply, "> ");
hexdump_compact(persistent.pubkey, sizeof(persistent.pubkey), &(reply[2]), 70);
@@ -600,6 +590,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
persistent.airtimeFactor = atof (&config[3]);
// savePrefs();
strcpy (reply, "OK");
/*
} else if (memcmp (config, "int.thresh ", 11) == 0) {
_prefs->interference_threshold = atoi (&config[11]);
// savePrefs();
@@ -612,6 +603,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
_prefs->multi_acks = atoi (&config[11]);
// savePrefs();
strcpy (reply, "OK");
*/
} else if (memcmp (config, "allow.read.only ", 16) == 0) {
if (memcmp (&config[16], "on", 2) == 0) {
persistent.allowReadOnly = 1;
@@ -621,7 +613,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
strcpy (reply, "OK");
}
//savePrefs();
/*
} else if (memcmp (config, "flood.advert.interval ", 22) == 0) {
int hours = _atoi (&config[22]);
if ((hours > 0 && hours < 3) || (hours > 48)) {
@@ -642,6 +634,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
savePrefs();
strcpy (reply, "OK");
}
*/
} else if (memcmp (config, "guest.password ", 15) == 0) {
strncpy (persistent.guestPassword, &config[15], sizeof (persistent.guestPassword));
// savePrefs();
@@ -658,12 +651,13 @@ void processCommand (char *cmd, NodeEntry *remNode) {
}
// savePrefs();
strcpy (reply, persistent.doRepeat ? "OK - repeat is now ON" : "OK - repeat is now OFF");
/*
} else if (memcmp (config, "radio ", 6) == 0) {
strcpy (tmp, &config[6]);
const char *parts[4];
int num = mesh::Utils::parseTextParts (tmp, parts, 4);
float freq = num > 0 ? strtof (parts[0], nullptr) : 0.0f;
float bw = num > 1 ? strtof (parts[1], nullptr) : 0.0f;
float freq = num > 0 ? strtof (parts[0], 0) : 0.0f;
float bw = num > 1 ? strtof (parts[1], 0) : 0.0f;
uint8_t sf = num > 2 ? atoi (parts[2]) : 0;
uint8_t cr = num > 3 ? atoi (parts[3]) : 0;
if (freq >= 300.0f && freq <= 2500.0f && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f) {
@@ -676,6 +670,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
} else {
strcpy (reply, "Error, invalid radio params");
}
*/
} else if (memcmp (config, "lat ", 4) == 0) {
double lat = atof (&config[4]);
lat *= 1000000;
@@ -688,6 +683,7 @@ void processCommand (char *cmd, NodeEntry *remNode) {
persistent.longitude = lon;
// savePrefs();
strcpy (reply, "OK");
/*
} else if (memcmp (config, "rxdelay ", 8) == 0) {
float db = atof (&config[8]);
if (db >= 0) {
@@ -729,14 +725,16 @@ void processCommand (char *cmd, NodeEntry *remNode) {
savePrefs();
_callbacks->setTxPower (_prefs->tx_power_dbm);
strcpy (reply, "OK");
*/
} else if (memcmp (config, "freq ", 5) == 0) {
double freq = atof (&config[5]);
uint32_t newFreq = mhzToHzLimited (persistent.frequencyInHz);
uint32_t newFreq = mhzToHzLimited (persistent.loraSettings.frequencyInHz);
if (newFreq != 0) {
persistent.frequencyInHz = newFreq;
persistent.loraSettings.frequencyInHz = newFreq;
}
// savePrefs();
strcpy (reply, "OK - reboot to apply");
} else if (memcmp (config, "adc.multiplier ", 15) == 0) {
persistent.adcMultiplier = atof (&config[15]);
if (persistent.adcMultiplier == 0.0f) {

View File

@@ -7,6 +7,7 @@
#include "util/log.h"
#include <string.h>
#define MIN_LOCAL_ADVERT_INTERVAL 60
void sendEncryptedFrame (const NodeEntry *targetNode, uint8_t payloadType, const uint8_t *plain, size_t plainLen);