Skip to content

Commit

Permalink
fix RSSI read avg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MikyM0use authored and MikyM0use committed Jul 9, 2016
1 parent 6dff799 commit 814543f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jafar_sketch/jafar_osd.ino
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void osd_scanner() {
}

TV.println(92, 3, (int)s_timer, DEC);
TV.delay(500);
TV.delay(100);
}
s_timer = 9;
}
Expand Down
2 changes: 1 addition & 1 deletion jafar_sketch/jafar_sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void loop(void) {
menu_band = menu_pos - 1;
timer = TIMER_INIT_VALUE;

#ifdef USE_OLED /debounce and peace
#ifdef USE_OLED //debounce and peace
delay(200);
#else
TV.delay(200);
Expand Down
16 changes: 9 additions & 7 deletions jafar_sketch/rx5808.ino
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,16 @@ void RX5808::_wait_rssi() {
delay(MIN_TUNE_TIME);
}

//simple avg of 4 value
uint16_t RX5808::_readRSSI() {
uint32_t sum = 0;
for (uint8_t i = 0; i < 10; i++)
{
sum += analogRead(_rssiPin);
delay(2);
}
return sum / 10; // average
volatile uint32_t sum = 0;
delay(9);
sum = analogRead(_rssiPin);
sum += analogRead(_rssiPin);
delay(1);
sum += analogRead(_rssiPin);
sum += analogRead(_rssiPin);
return sum / 4.0;
}

//compute the min and max RSSI value and store the values in EEPROM
Expand Down

0 comments on commit 814543f

Please sign in to comment.