dhiltonp

band gap usb patch

Feb 3rd, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.83 KB | None | 0 0
  1. diff --git a/libraries/hexbright/hexbright.cpp b/libraries/hexbright/hexbright.cpp
  2. index 50c7f5f..e96b0e1 100755
  3. --- a/libraries/hexbright/hexbright.cpp
  4. +++ b/libraries/hexbright/hexbright.cpp
  5. @@ -1090,8 +1090,13 @@ int band_gap_reading = 0;
  6.  int lowest_band_gap_reading = 1000;
  7.  
  8.  void hexbright::read_avr_voltage() {
  9. -  band_gap_reading = read_adc(APIN_BAND_GAP);
  10. -  lowest_band_gap_reading = band_gap_reading < lowest_band_gap_reading ? band_gap_reading : lowest_band_gap_reading;
  11. +  static unsigned char battery_time = 0;
  12. +  if(get_charge_state() == BATTERY) {
  13. +    battery_time++;
  14. +  } else if(battery_time>200) {
  15. +    band_gap_reading = read_adc(APIN_BAND_GAP);
  16. +    lowest_band_gap_reading = band_gap_reading < lowest_band_gap_reading ? band_gap_reading : lowest_band_gap_reading;
  17. +  }
  18.  }
  19.  
  20.  int hexbright::get_avr_voltage() {
Advertisement
Add Comment
Please, Sign In to add comment