Skip to content

Commit

Permalink
turn on CDP when ignition switches on (commaai#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini authored Oct 1, 2019
1 parent 847a35d commit 8c1df55
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ int main(void) {
#endif

#ifdef EON
bool ignition_prev = false;
// have to save power
if (hw_type == HW_TYPE_WHITE_PANDA) {
current_board->set_esp_gps_mode(ESP_GPS_DISABLED);
Expand Down Expand Up @@ -747,6 +748,13 @@ int main(void) {
uint64_t cnt = 0;

for (cnt=0;;cnt++) {
#ifdef EON
// set CDP mode on rising edge of ignition to start charging EON again in case we turned charging off
if (current_board->check_ignition() && !ignition_prev) {
current_board->set_usb_power_mode(USB_POWER_CDP);
}
ignition_prev = current_board->check_ignition();
#endif
if (power_save_status == POWER_SAVE_STATUS_DISABLED) {
int div_mode = ((usb_power_mode == USB_POWER_DCP) ? 4 : 1);

Expand Down

0 comments on commit 8c1df55

Please sign in to comment.