Skip to content

Commit

Permalink
Analog power no longer shuts off when not using sleep mode, fix debug…
Browse files Browse the repository at this point in the history
… file writing, remove startlogging delay
  • Loading branch information
superchap123 committed Jul 31, 2017
1 parent a9af062 commit f810a7b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/ALog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ void ALog::startLogging(){
*/
// Wake up

delay(50);
//delay(50);
//Serial.println("Rise and shine!");

wdt_disable();
Expand Down Expand Up @@ -1392,8 +1392,15 @@ void ALog::sensorPowerOn(){
* @details
* This powers external devices.
*/
digitalWrite(SensorPowerPin,HIGH);
delay(5);

if (_use_sleep_mode){
digitalWrite(SensorPowerPin,HIGH);
delay(5);
}
else if (first_log_after_booting_up){
digitalWrite(SensorPowerPin,HIGH);
delay(5);
}
}

void ALog::sensorPowerOff(){
Expand All @@ -1402,8 +1409,10 @@ void ALog::sensorPowerOff(){
* @details
* This cuts 3V3 power to external devices.
*/
digitalWrite(SensorPowerPin,LOW);
delay(5);
if (_use_sleep_mode){
digitalWrite(SensorPowerPin,LOW);
//delay(5);
}
}

// DEPRECATED
Expand Down Expand Up @@ -2880,6 +2889,8 @@ float ALog::analogReadOversample(uint8_t pin, uint8_t adc_bits, \
float precision_above_ten = pow(2., adc_bits - 10.);
analog_reading = avg_reading / precision_above_ten; // 0-1023, but float

end_logging_to_otherfile();

return analog_reading;
}

Expand Down

0 comments on commit f810a7b

Please sign in to comment.