Jm Casler 2022-03-02 20:42:06 -08:00
commit a450aac3b5
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -31,7 +31,7 @@ void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
uint8_t AirTime::currentPeriodIndex() uint8_t AirTime::currentPeriodIndex()
{ {
return ((getSecondsSinceBoot() / SECONDS_PER_PERIOD) % myNodeInfo.air_period_rx_count); return ((getSecondsSinceBoot() / SECONDS_PER_PERIOD) % PERIODS_TO_LOG);
} }
uint8_t AirTime::getPeriodUtilMinute() { uint8_t AirTime::getPeriodUtilMinute() {
@ -48,7 +48,7 @@ void AirTime::airtimeRotatePeriod()
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) { if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
DEBUG_MSG("Rotating airtimes to a new period = %u\n", this->currentPeriodIndex()); DEBUG_MSG("Rotating airtimes to a new period = %u\n", this->currentPeriodIndex());
for (int i = myNodeInfo.air_period_rx_count - 2; i >= 0; --i) { for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i]; this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
this->airtimes.periodRX[i + 1] = this->airtimes.periodRX[i]; this->airtimes.periodRX[i + 1] = this->airtimes.periodRX[i];
this->airtimes.periodRX_ALL[i + 1] = this->airtimes.periodRX_ALL[i]; this->airtimes.periodRX_ALL[i + 1] = this->airtimes.periodRX_ALL[i];
@ -83,7 +83,7 @@ uint32_t *AirTime::airtimeReport(reportTypes reportType)
uint8_t AirTime::getPeriodsToLog() uint8_t AirTime::getPeriodsToLog()
{ {
return myNodeInfo.air_period_rx_count; return PERIODS_TO_LOG;
} }
uint32_t AirTime::getSecondsPerPeriod() uint32_t AirTime::getSecondsPerPeriod()

Wyświetl plik

@ -26,7 +26,7 @@
#define CHANNEL_UTILIZATION_PERIODS 6 #define CHANNEL_UTILIZATION_PERIODS 6
#define SECONDS_PER_PERIOD 3600 #define SECONDS_PER_PERIOD 3600
#define PERIODS_TO_LOG 24 #define PERIODS_TO_LOG 8
#define MINUTES_IN_HOUR 60 #define MINUTES_IN_HOUR 60
#define SECONDS_IN_MINUTE 60 #define SECONDS_IN_MINUTE 60
#define MS_IN_HOUR (MINUTES_IN_HOUR * SECONDS_IN_MINUTE * 1000) #define MS_IN_HOUR (MINUTES_IN_HOUR * SECONDS_IN_MINUTE * 1000)