Fix tophone build error

This commit is contained in:
Jm Casler
2022-03-02 18:55:11 -08:00
parent 8eaaf842ab
commit 2c7b3acbb9
6 changed files with 49 additions and 17 deletions

View File

@@ -31,7 +31,7 @@ void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
uint8_t AirTime::currentPeriodIndex()
{
return ((getSecondsSinceBoot() / SECONDS_PER_PERIOD) % PERIODS_TO_LOG);
return ((getSecondsSinceBoot() / SECONDS_PER_PERIOD) % myNodeInfo.air_period_rx_count);
}
uint8_t AirTime::getPeriodUtilMinute() {
@@ -48,7 +48,7 @@ void AirTime::airtimeRotatePeriod()
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
DEBUG_MSG("Rotating airtimes to a new period = %u\n", this->currentPeriodIndex());
for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
for (int i = myNodeInfo.air_period_rx_count - 2; i >= 0; --i) {
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
this->airtimes.periodRX[i + 1] = this->airtimes.periodRX[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()
{
return PERIODS_TO_LOG;
return myNodeInfo.air_period_rx_count;
}
uint32_t AirTime::getSecondsPerPeriod()
@@ -140,7 +140,7 @@ int32_t AirTime::runOnce()
}
// Init airtime windows to all 0
for (int i = 0; i < PERIODS_TO_LOG; i++) {
for (int i = 0; i < myNodeInfo.air_period_rx_count; i++) {
this->airtimes.periodTX[i] = 0;
this->airtimes.periodRX[i] = 0;
this->airtimes.periodRX_ALL[i] = 0;