mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-31 23:21:06 +00:00
@@ -206,6 +206,13 @@ void MeshService::reloadConfig()
|
||||
nodeDB.saveToDisk();
|
||||
}
|
||||
|
||||
/// The owner User record just got updated, update our node DB and broadcast the info into the mesh
|
||||
void MeshService::reloadOwner()
|
||||
{
|
||||
sendOurOwner();
|
||||
nodeDB.saveToDisk();
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a ToRadio buffer parse it and properly handle it (setup radio, owner or send packet into the mesh)
|
||||
* Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep a
|
||||
@@ -292,8 +299,8 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
|
||||
p->decoded.which_payload = SubPacket_position_tag;
|
||||
|
||||
Position &pos = p->decoded.position;
|
||||
// !zero or !zero lat/long means valid
|
||||
if (gps->latitude != 0 || gps->longitude != 0) {
|
||||
|
||||
if (gps->hasLock()) {
|
||||
if (gps->altitude != 0)
|
||||
pos.altitude = gps->altitude;
|
||||
pos.latitude_i = gps->latitude;
|
||||
|
||||
@@ -67,7 +67,7 @@ class MeshService
|
||||
void reloadConfig();
|
||||
|
||||
/// The owner User record just got updated, update our node DB and broadcast the info into the mesh
|
||||
void reloadOwner() { sendOurOwner(); }
|
||||
void reloadOwner();
|
||||
|
||||
/// Called when the user wakes up our GUI, normally sends our latest location to the mesh (if we have it), otherwise at least
|
||||
/// sends our owner
|
||||
|
||||
@@ -41,6 +41,8 @@ bool RF95Interface::init()
|
||||
if (power > MAX_POWER) // This chip has lower power limits than some
|
||||
power = MAX_POWER;
|
||||
|
||||
limitPower();
|
||||
|
||||
iface = lora = new RadioLibRF95(&module);
|
||||
|
||||
#ifdef RF95_TCXO
|
||||
|
||||
@@ -107,7 +107,7 @@ bool RadioInterface::init()
|
||||
* djb2 by Dan Bernstein.
|
||||
* http://www.cse.yorku.ca/~oz/hash.html
|
||||
*/
|
||||
unsigned long hash(char *str)
|
||||
unsigned long hash(const char *str)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
@@ -136,6 +136,25 @@ void RadioInterface::applyModemConfig()
|
||||
power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some regulatory regions limit xmit power.
|
||||
* This function should be called by subclasses after setting their desired power. It might lower it
|
||||
*/
|
||||
void RadioInterface::limitPower()
|
||||
{
|
||||
uint8_t maxPower = 255; // No limit
|
||||
|
||||
#ifdef HW_VERSION_JP
|
||||
maxPower = 13; // See https://github.com/meshtastic/Meshtastic-device/issues/346
|
||||
#endif
|
||||
if (power > maxPower) {
|
||||
DEBUG_MSG("Lowering transmit power because of regulatory limits\n");
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
DEBUG_MSG("Set radio: final power level=%d\n", power);
|
||||
}
|
||||
|
||||
ErrorCode SimRadio::send(MeshPacket *p)
|
||||
{
|
||||
DEBUG_MSG("SimRadio.send\n");
|
||||
|
||||
@@ -119,6 +119,12 @@ class RadioInterface : protected concurrency::NotifiedWorkerThread
|
||||
|
||||
virtual void loop() {} // Idle processing
|
||||
|
||||
/**
|
||||
* Some regulatory regions limit xmit power.
|
||||
* This function should be called by subclasses after setting their desired power. It might lower it
|
||||
*/
|
||||
void limitPower();
|
||||
|
||||
/**
|
||||
* Convert our modemConfig enum into wf, sf, etc...
|
||||
*
|
||||
|
||||
@@ -43,6 +43,9 @@ bool SX1262Interface::init()
|
||||
|
||||
if (power > 22) // This chip has lower power limits than some
|
||||
power = 22;
|
||||
|
||||
limitPower();
|
||||
|
||||
int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO);
|
||||
DEBUG_MSG("SX1262 init result %d\n", res);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user