fix #346 limit tx power in japan

1.2-legacy
geeksville 2020-09-15 18:54:50 -07:00
rodzic 7d4058f49d
commit c6d93d1a28
4 zmienionych plików z 30 dodań i 0 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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");

Wyświetl plik

@ -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...
*

Wyświetl plik

@ -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);