Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/libraries/hexbright/hexbright.cpp b/libraries/hexbright/hexbright.cpp
- index 2cd0511..f28bee1 100755
- --- a/libraries/hexbright/hexbright.cpp
- +++ b/libraries/hexbright/hexbright.cpp
- @@ -1080,7 +1080,7 @@ void hexbright::detect_overheating() {
- ////////////////AVR VOLTAGE////////////////////
- ///////////////////////////////////////////////
- -int band_gap_reading = 0;
- +int band_gap_reading = 1000;
- int lowest_band_gap_reading = 1000;
- void hexbright::read_avr_voltage() {
- @@ -1093,7 +1093,7 @@ void hexbright::read_avr_voltage() {
- // ADC register from source: http://www.sourcecodebrowser.com/avr-libc/1.8.0/iomx8_8h_source.html
- // it seems that this may be incompatible with assembly code; ADCW should work if that becomes an issue.
- - band_gap_reading = ADC;
- + band_gap_reading = (ADC+band_gap_reading*7)/8;
- lowest_band_gap_reading = band_gap_reading < lowest_band_gap_reading ? band_gap_reading : lowest_band_gap_r
- }
- @@ -1107,7 +1107,8 @@ BOOL hexbright::low_voltage_state() {
- static BOOL low = false;
- // lower band gap value corresponds to a higher voltage, trigger
- // low voltage state if band gap value goes too high.
- - if (band_gap_reading > lowest_band_gap_reading+4) {
- + if (get_charge_state()==BATTERY &&
- + band_gap_reading > lowest_band_gap_reading+4) {
- low = true;
- }
- return low;
Advertisement
Add Comment
Please, Sign In to add comment