From 8b212afe59733a55b89cf012fc6a5297c083875e Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Wed, 31 Mar 2021 14:13:18 +0100 Subject: [PATCH] Setting the TxPower to -32 disables transmission --- main/rf.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main/rf.cpp b/main/rf.cpp index 0fadbaa..de20f0a 100644 --- a/main/rf.cpp +++ b/main/rf.cpp @@ -109,6 +109,7 @@ static uint32_t ReceiveUntil(TickType_t End) static uint8_t Transmit(uint8_t TxChan, const uint8_t *PacketByte, uint8_t Thresh, uint8_t MaxWait=7) { if(PacketByte==0) return 0; // if no packet to send: simply return + // if(Parameters.TxPower==(-32)) return 0; // if transmission turned OFF if(MaxWait) { for( ; MaxWait; MaxWait--) // wait for a given maximum time for a free radio channel @@ -153,7 +154,7 @@ static void TimeSlot(uint8_t TxChan, uint32_t SlotLen, const uint8_t *PacketByte if( (TxTime==0) || (TxTime>=MaxTxTime) ) TxTime = RX_Random%MaxTxTime; // if TxTime out of limits, setup a random TxTime TickType_t Tx = Start + TxTime; // Tx = the moment to start transmission ReceiveUntil(Tx); // listen until this time comes - if( (TX_Credit>0) && (PacketByte) ) // when packet to transmit is given and there is still TX credit left: + if( (TX_Credit>0) && Parameters.TxPower!=(-32) && (PacketByte) ) // when packet to transmit is given and there is still TX credit left: if(Transmit(TxChan, PacketByte, Rx_RSSI, MaxWait)) TX_Credit-=5; // attempt to transmit the packet ReceiveUntil(End); // listen till the end of the time-slot } @@ -479,7 +480,7 @@ extern "C" bool WANtx = 0; uint16_t SlotEnd = 1240; if(WAN_BackOff) WAN_BackOff--; - else // decide to transmit in this slot + else if(Parameters.TxPower!=(-32)) // decide to transmit in this slot { if(WANdev.State==0 || WANdev.State==2) // { WANtx=1; SlotEnd=1200; } } @@ -499,7 +500,7 @@ extern "C" OGN1_Packet TxPkt = TxPkt0->Packet; TxPkt.Dewhiten(); XorShift32(RX_Random); - if(PAWtxBackOff==0 && !TxPkt.Header.Relay && Packet.Copy(TxPkt) && TxPkt.Position.Time<60) + if(PAWtxBackOff==0 && Parameters.TxPower!=(-32) && !TxPkt.Header.Relay && Packet.Copy(TxPkt) && TxPkt.Position.Time<60) { TRX.setModeStandby(); TRX.PAW_Configure(PAW_SYNC); TRX.WriteTxPower(Parameters.TxPower+6);