mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge branch 'main' into rx_delay
# Conflicts: # examples/simple_repeater/main.cpp # examples/simple_room_server/main.cpp
This commit is contained in:
commit
61b09e9445
3 changed files with 46 additions and 9 deletions
|
|
@ -120,7 +120,8 @@ struct NodePrefs { // persisted to file
|
|||
char password[16];
|
||||
float freq;
|
||||
uint8_t tx_power_dbm;
|
||||
uint8_t unused[3];
|
||||
uint8_t disable_fwd;
|
||||
uint8_t unused[2];
|
||||
float rx_delay_base;
|
||||
};
|
||||
|
||||
|
|
@ -191,7 +192,7 @@ protected:
|
|||
}
|
||||
|
||||
bool allowPacketForward(const mesh::Packet* packet) override {
|
||||
return true; // Yes, allow packet to be forwarded
|
||||
return !_prefs.disable_fwd;
|
||||
}
|
||||
|
||||
int calcRxDelay(float score, uint32_t air_time) const override {
|
||||
|
|
@ -375,6 +376,7 @@ public:
|
|||
num_clients = 0;
|
||||
|
||||
// defaults
|
||||
memset(&_prefs, 0, sizeof(_prefs));
|
||||
_prefs.airtime_factor = 1.0; // one half
|
||||
_prefs.rx_delay_base = 10.0;
|
||||
strncpy(_prefs.node_name, ADVERT_NAME, sizeof(_prefs.node_name)-1);
|
||||
|
|
@ -385,7 +387,6 @@ public:
|
|||
_prefs.password[sizeof(_prefs.password)-1] = 0; // truncate if necessary
|
||||
_prefs.freq = LORA_FREQ;
|
||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||
memset(_prefs.unused, 0, sizeof(_prefs.unused));
|
||||
}
|
||||
|
||||
float getFreqPref() const { return _prefs.freq; }
|
||||
|
|
@ -485,6 +486,10 @@ public:
|
|||
_prefs.node_name[sizeof(_prefs.node_name)-1] = 0; // truncate if nec
|
||||
savePrefs();
|
||||
strcpy(reply, "OK");
|
||||
} else if (memcmp(config, "repeat ", 7) == 0) {
|
||||
_prefs.disable_fwd = memcmp(&config[7], "off", 3) == 0;
|
||||
savePrefs();
|
||||
strcpy(reply, _prefs.disable_fwd ? "OK - repeat is now OFF" : "OK - repeat is now ON");
|
||||
} else if (memcmp(config, "lat ", 4) == 0) {
|
||||
_prefs.node_lat = atof(&config[4]);
|
||||
savePrefs();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue