Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add voltage offset #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sunray/config_example.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ Also, you may choose the serial port below for serial monitor output (CONSOLE).
//#define CURRENT_FACTOR 1.98 // PCB1.4 (non-bridged INA169, max. 2.5A)
//#define CURRENT_FACTOR 2.941 // PCB1.4 (bridged INA169, max. 5A)

#define BATT_VOLTAGE_OFFSET 0.0 // offset to apply to the PCB voltage readings

#define GO_HOME_VOLTAGE 21.5 // start going to dock below this voltage
// The battery will charge if both battery voltage is below that value and charging current is above that value.
#define BAT_FULL_VOLTAGE 28.7 // start mowing again at this voltage
Expand Down
4 changes: 2 additions & 2 deletions sunray/src/driver/AmRobotDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ void AmBatteryDriver::run(){

float AmBatteryDriver::getBatteryVoltage(){
float voltage = ((float)ADC2voltage(analogRead(pinBatteryVoltage))) * batteryFactor;
return voltage;
return voltage + BATT_VOLTAGE_OFFSET;
}

float AmBatteryDriver::getChargeVoltage(){
float voltage = ((float)ADC2voltage(analogRead(pinChargeVoltage))) * batteryFactor;
return voltage;
return voltage + BATT_VOLTAGE_OFFSET;
}


Expand Down