mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 18:31:37 +00:00
Send NAK only to the API upon duty cycle limit
This commit is contained in:
parent
a3b93a4dcf
commit
e13fb9919e
@ -200,14 +200,18 @@ ErrorCode Router::send(MeshPacket *p)
|
|||||||
|
|
||||||
// Abort sending if we are violating the duty cycle
|
// Abort sending if we are violating the duty cycle
|
||||||
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
||||||
float hourlyTxPercent = airTime->utilizationTXPercent();
|
float hourlyTxPercent = airTime->utilizationTXPercent();
|
||||||
if (hourlyTxPercent > myRegion->dutyCycle) {
|
if (hourlyTxPercent > myRegion->dutyCycle) {
|
||||||
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
||||||
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
||||||
Routing_Error err = Routing_Error_DUTY_CYCLE_LIMIT;
|
Routing_Error err = Routing_Error_DUTY_CYCLE_LIMIT;
|
||||||
abortSendAndNak(err, p);
|
if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh
|
||||||
return err;
|
abortSendAndNak(err, p);
|
||||||
}
|
} else {
|
||||||
|
packetPool.release(p);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PacketId nakId = p->decoded.which_ackVariant == SubPacket_fail_id_tag ? p->decoded.ackVariant.fail_id : 0;
|
// PacketId nakId = p->decoded.which_ackVariant == SubPacket_fail_id_tag ? p->decoded.ackVariant.fail_id : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user