mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-15 17:42:12 +00:00
fix #346 limit tx power in japan
This commit is contained in:
parent
7d4058f49d
commit
c6d93d1a28
@ -41,6 +41,8 @@ bool RF95Interface::init()
|
|||||||
if (power > MAX_POWER) // This chip has lower power limits than some
|
if (power > MAX_POWER) // This chip has lower power limits than some
|
||||||
power = MAX_POWER;
|
power = MAX_POWER;
|
||||||
|
|
||||||
|
limitPower();
|
||||||
|
|
||||||
iface = lora = new RadioLibRF95(&module);
|
iface = lora = new RadioLibRF95(&module);
|
||||||
|
|
||||||
#ifdef RF95_TCXO
|
#ifdef RF95_TCXO
|
||||||
|
@ -136,6 +136,25 @@ void RadioInterface::applyModemConfig()
|
|||||||
power);
|
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)
|
ErrorCode SimRadio::send(MeshPacket *p)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("SimRadio.send\n");
|
DEBUG_MSG("SimRadio.send\n");
|
||||||
|
@ -119,6 +119,12 @@ class RadioInterface : protected concurrency::NotifiedWorkerThread
|
|||||||
|
|
||||||
virtual void loop() {} // Idle processing
|
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...
|
* 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
|
if (power > 22) // This chip has lower power limits than some
|
||||||
power = 22;
|
power = 22;
|
||||||
|
|
||||||
|
limitPower();
|
||||||
|
|
||||||
int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO);
|
int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO);
|
||||||
DEBUG_MSG("SX1262 init result %d\n", res);
|
DEBUG_MSG("SX1262 init result %d\n", res);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user