Skip to content

Commit

Permalink
Devel escalade (#49)
Browse files Browse the repository at this point in the history
* Decrease build time for dbc files

* Fix fan control when not plugged into panda

* Fix unicode bug in DoUninstall reading

* Make visiond compile on pc (commaai#874)

* Make DBC preprocessing deterministic

* Add fingerprint (commaai#875)

* Fixes for various merge and refactoring fallout, typo fixes. (commaai#878)

* Fixes for various merge and refactoring fallout, typo fixes.

* Tab->Spaces

* Update driving model (commaai#880)

* Fix typo (commaai#891)

* Reimplemented core changes on 0.6.6

* updated readme and dbc

* Added 2017 Bolt fingerprint

* updated readme

* this should have never worked...

* I guess I was wrong about that

* Safe passthrough (#9)

* stuff

* experimenting with timer 12 interval

* experimetning with timers

* more debugging

* more timer stuff

* timer works - adjusting period

* first bold attempt

* booboo

* more whoopsies

* ugh

* attempting cleaner impl

* fixes

* more fixing

* more fixes

* more fixes

* workies

* Added lkas hook default

* Fixed missing parens

* Boldness - enabling the lkas send

* Fixed activation of op lkas

* tried to do this the right way...

* very broken

* debugging

* more attempts to fix

* debugging

* grr

* disabling timer

* sanity check

* switching to timer 5

* little cleanup

* debugging

* timer 5 is special...

* lets try timer 6

* debugging

* tim7

* whoops

* debugging

* just the comment

* ddd

* maybe found bug..

* debuggery

* added lkas to all models

* bold implementation

* gotta return that value...

* Now we should get some data

* removing hardcoded null

* wrong bus no?

* bloop

* Lysdexia...

* whoops

* better debug

* debugs

* better debug; maybe fix rc

* woops

* more whoops

* trying some fixery

* I did the pointers wrong...

* more pointer issues

* ugh

* trying volatile

* more vol

* more volatiles

* more volatile

* removing volatiles from structs

* vol again

* maybe a fix?

* maybe don't need on op

* rc was wrong

* my bits are weak

* shifty

* idk

* I suck at bitwise everything

* only send once

* bit what?

* gah!

* mathys lol

* I'm not smart enough for this

* bits are stupid

* cleanup, should fix all faults

* lkas->pump, no camera mode

* timer started in safety init, configurable interva

* note about init

* something really didn't work...

* maybe not littleendian?

* improved safety, can#, etc

* casing issue

* removed hook, cleanup names, etc

* moved to safety.h

* trying to fix errors

* pointers...

* more pointer confusion

* yet more pointers...

* null typo

* pump disabled on no_output

* added debug comments

* abstracting

* missed a couple

* bugs

* more bugs

* made buffer volatile

* unvolatile casting

* bug

* casting syntax...

* debug message updates

* if ordering issue

* bugfix, cleanup

* add pedal_pressed

* missing or 1 on stock RIR

* more volatile

* very strange behavior

* bug; reduced volatility

* casting

* added 2012 prius fingerprint

* Hardcoded ignition on...

* commented out some blocking events

* removed hardcoded ign

* rolling back all prius junk

* added equinox

* hardcode escalade

* disabling forwarding

* enable radar; increase steer_max

* removed radar

* radar back; more power!!

* torque to 550

Co-authored-by: Riccardo <riccardo.biasini@gmail.com>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Alex Wang <36569033@qq.com>
Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: jshuler <jshuler@gmail.com>
  • Loading branch information
7 people authored Feb 20, 2021
1 parent d7f0b40 commit 234841f
Show file tree
Hide file tree
Showing 36 changed files with 606 additions and 179 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![](https://i.imgur.com/UetIFyH.jpg)](#)

Welcome to openpilot
Welcome to openpilot SPECIFICALLY FOR THE CHEVY BOLT (NO PASSTHROUGH)
======

[openpilot](http://github.com/commaai/openpilot) is an open source driver assistance system. Currently, it performs the functions of Adaptive Cruise Control (ACC) and Automated Lane Centering (ALC) for selected Honda, Toyota, Acura, Lexus, Chevrolet, Hyundai, Kia, Subaru, Volkswagen. It's about on par with Tesla Autopilot and GM Super Cruise, and better than [all other manufacturers](http://www.thedrive.com/tech/5707/the-war-for-autonomous-driving-part-iii-us-vs-germany-vs-japan).
Expand Down Expand Up @@ -63,6 +63,7 @@ Supported Cars
| Buick<sup>3</sup> | Regal 2018<sup>6</sup> | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| Chevrolet<sup>3</sup> | Malibu 2017<sup>6</sup> | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| Chevrolet<sup>3</sup> | Volt 2017-18<sup>6</sup> | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| Chevrolet<sup>3</sup> | Bolt 2019 | Driver Confidence II | Yes | No | 0mph | 7mph |
| Cadillac<sup>3</sup> | ATS 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| Chrysler | Pacifica 2017-18<sup>7</sup> | Adaptive Cruise | Yes | Stock | 0mph | 9mph |
| Chrysler | Pacifica Hybrid 2017-18<sup>7</sup>| Adaptive Cruise | Yes | Stock | 0mph | 9mph |
Expand Down
Binary file modified models/driving_model.dlc
Binary file not shown.
6 changes: 6 additions & 0 deletions opendbc/gm_global_a_powertrain.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ BO_ 1912 PSCM_778: 8 K43_PSCM

BO_ 1930 ASCM_78A: 7 K124_ASCM

BO_ 800 FCABrakingCmd: 6 XXX
SG_ RollingCounter : 5|2@0+ (1,0) [0|3] "" XXX
SG_ Checksum : 27|20@0+ (1,0) [0|2047] "" XXX
SG_ BrakeCmdActive : 3|1@1+ (1,0) [0|1] "" XXX
SG_ BrakingForce : 2|7@0+ (1,0) [0|7] "" XXX

BO_TX_BU_ 384 : K124_ASCM,NEO;
BO_TX_BU_ 880 : NEO,K124_ASCM;
BO_TX_BU_ 1033 : K124_ASCM,NEO;
Expand Down
2 changes: 1 addition & 1 deletion panda/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.9
v1.5.33
2 changes: 2 additions & 0 deletions panda/board/boards/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ void peripherals_init(void){
RCC->APB1ENR |= RCC_APB1ENR_TIM4EN; // gmlan_alt and IR PWM
//RCC->APB1ENR |= RCC_APB1ENR_TIM5EN;
//RCC->APB1ENR |= RCC_APB1ENR_TIM6EN;
RCC->APB1ENR |= RCC_APB1ENR_TIM7EN;
RCC->APB1ENR |= RCC_APB1ENR_PWREN; // for RTC config
//RCC->APB1ENR |= RCC_APB1ENR_TIM12EN;
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
//RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
Expand Down
22 changes: 22 additions & 0 deletions panda/board/drivers/can.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ void ignition_can_hook(CAN_FIFOMailBox_TypeDef *to_push) {
ignition_can = (GET_BYTE(to_push, 2) & 0x2) != 0;
}
}
//TODO: remove this - for testing only
//ignition_can = true;
}

// CAN receive handlers
Expand Down Expand Up @@ -420,6 +422,26 @@ void CAN3_TX_IRQHandler(void) { process_can(2); }
void CAN3_RX0_IRQHandler(void) { can_rx(2); }
void CAN3_SCE_IRQHandler(void) { can_sce(CAN3); }


void pump_send(pump_hook hook) {
uint8_t bus_number = 0U;
if (hook == NULL) return;
CAN_FIFOMailBox_TypeDef *to_push = hook();
if (to_push != NULL) {
if (bus_number < BUS_MAX) {
// add CAN packet to send queuesend
// bus number isn't passed through
to_push->RDTR &= 0xF;
if ((bus_number == 3U) && (can_num_lookup[3] == 0xFFU)) {
gmlan_send_errs += bitbang_gmlan(to_push) ? 0U : 1U;
} else {
can_fwd_errs += can_push(can_queues[bus_number], to_push) ? 0U : 1U;
process_can(CAN_NUM_FROM_BUS_NUM(bus_number));
}
}
}
}

void can_send(CAN_FIFOMailBox_TypeDef *to_push, uint8_t bus_number) {
if (safety_tx_hook(to_push) != 0) {
if (bus_number < BUS_MAX) {
Expand Down
41 changes: 41 additions & 0 deletions panda/board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,28 @@ int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) {

// ***************************** main code *****************************

// *pump_hook message_pump_hook;

// void enable_message_pump(uint32_t divider, *pump_hook hook) {
// //Timer for LKAS pump
// message_pump_hook = hook;
// timer_init(TIM7, divider);
// NVIC_EnableIRQ(TIM7_IRQn);
// }

// void update_message_pump_rate(uint32_t divider) {
// //TODO: test if this works
// TIM7->PSC = divider-1;
// }

// void disable_message_pump() {
// NVIC_DisableIRQ(TIM7_IRQn);
// pump_hook = null;
// }




// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
void __initialize_hardware_early(void) {
early();
Expand All @@ -646,6 +668,20 @@ uint64_t tcnt = 0;
#define EON_HEARTBEAT_IGNITION_CNT_ON 5U
#define EON_HEARTBEAT_IGNITION_CNT_OFF 2U




void TIM7_IRQHandler(void) {
//TODO: This needs to check for ignition and stop itself?
if (TIM7->SR != 0) {
if (message_pump_hook != NULL) {
pump_send(message_pump_hook);
}
}
TIM7->SR = 0;
}


// called once per second
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
void TIM1_BRK_TIM9_IRQHandler(void) {
Expand Down Expand Up @@ -760,6 +796,7 @@ int main(void) {
TIM2->EGR = TIM_EGR_UG;
// use TIM2->CNT to read


// default to silent mode to prevent issues with Ford
// hardcode a specific safety mode if you want to force the panda to be in a specific mode
int err = safety_set_mode(SAFETY_NOOUTPUT, 0);
Expand Down Expand Up @@ -790,6 +827,10 @@ int main(void) {
timer_init(TIM9, 1464);
NVIC_EnableIRQ(TIM1_BRK_TIM9_IRQn);

// //Timer for LKAS pump
// timer_init(TIM7, 15);
// NVIC_EnableIRQ(TIM7_IRQn);

#ifdef DEBUG
puts("DEBUG ENABLED\n");
#endif
Expand Down
4 changes: 4 additions & 0 deletions panda/board/main_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ typedef struct board board;
typedef struct harness_configuration harness_configuration;
void can_flip_buses(uint8_t bus1, uint8_t bus2);
void can_set_obd(uint8_t harness_orientation, bool obd);
// void enable_message_pump(uint32_t divider, *pump_hook hook);
// void update_message_pump_rate(uint32_t divider);
// void disable_message_pump(void);


// ********************* Globals **********************
uint8_t hw_type = 0;
Expand Down
Binary file removed panda/board/obj/panda.bin.signed
Binary file not shown.
27 changes: 27 additions & 0 deletions panda/board/safety.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ int safety_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return current_hooks->fwd(bus_num, to_fwd);
}

pump_hook message_pump_hook;

void enable_message_pump(uint32_t divider, pump_hook hook) {
//Timer for LKAS pump
//todo: some kind of locking?
message_pump_active = true;
message_pump_hook = hook;
timer_init(TIM7, divider);
NVIC_EnableIRQ(TIM7_IRQn);
}

void update_message_pump_rate(uint32_t divider) {
//TODO: test if this works
TIM7->PSC = divider-1;
}

void disable_message_pump() {
NVIC_DisableIRQ(TIM7_IRQn);
message_pump_hook = NULL;
message_pump_active = false;
}


typedef struct {
uint16_t id;
const safety_hooks *hooks;
Expand Down Expand Up @@ -94,6 +117,10 @@ int safety_set_mode(uint16_t mode, int16_t param) {
if ((set_status == 0) && (current_hooks->init != NULL)) {
current_hooks->init(param);
}
if (mode == SAFETY_NOOUTPUT) {
puts("Disabling message pump due to SAFETY_NOOUTPUT");
disable_message_pump();
}
return set_status;
}

Expand Down
Loading

0 comments on commit 234841f

Please sign in to comment.