Skip to content

Commit

Permalink
tested works 100% will not fail
Browse files Browse the repository at this point in the history
  • Loading branch information
IshDeshpa committed Jul 13, 2024
1 parent 43bea1a commit 8e1d1f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Apps/Src/ReadCarCAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ void Task_ReadCarCAN(void *p_arg){
break;
}
case VOLTAGE_SUMMARY: {
UpdateDisplay_SetBattVoltage((*((uint32_t *)dataBuf.data)) >> 8); //uint24_t
UpdateDisplay_SetBattVoltage((*((uint32_t *)dataBuf.data)) & ~0xFF000000); //uint24_t
break;
}
case TEMPERATURE_SUMMARY: {
UpdateDisplay_SetBattTemperature((*((int32_t *)dataBuf.data)) >> 8); //uint24_t
UpdateDisplay_SetBattTemperature((*((int32_t *)dataBuf.data)) & ~0xFF000000); //uint24_t
break;
}
case CURRENT_DATA: {
Expand Down
8 changes: 4 additions & 4 deletions Apps/Src/UpdateDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const char* compStrings[15]= {
"supp",
"cruiseSt",
"rbsSt",
"gear",
"pv",
"pc",
"pt",
"gear",
// Fault code components
"oserr",
"faulterr"
Expand Down Expand Up @@ -172,7 +172,7 @@ UpdateDisplayError_t UpdateDisplay_SetPage(Page_t page){

/* WRAPPERS */
UpdateDisplayError_t UpdateDisplay_SetSOC(uint32_t percent){ // Integer percentage from 0-100
componentVals[SOC] = percent;
componentVals[SOC] = (percent/1000000);

return UPDATEDISPLAY_ERR_NONE;
}
Expand Down Expand Up @@ -232,13 +232,13 @@ UpdateDisplayError_t UpdateDisplay_SetBattVoltage(uint32_t mv){
}

UpdateDisplayError_t UpdateDisplay_SetBattTemperature(uint32_t val){
componentVals[PACK_TEMP] = val;
componentVals[PACK_TEMP] = (val/100);

return UPDATEDISPLAY_ERR_NONE;
}

UpdateDisplayError_t UpdateDisplay_SetBattCurrent(uint32_t val){
componentVals[PACK_CURRENT] = val;
componentVals[PACK_CURRENT] = (val/100);

return UPDATEDISPLAY_ERR_NONE;
}
Expand Down
14 changes: 9 additions & 5 deletions Scripts/bps_sim_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,21 @@ def rec():

# print('EN HVARR CONTACTOR: ' + str(ign_val))

batt_voltage = 0
batt_current = 0
batt_

def send():
global ign_val
while 1:
out = 'T1021' + ('07' if ign_val else '06') + chr(13)
ser.write(out.encode('ascii'))
print(out)

out = 'T1021' + ('07' if ign_val else '06') + chr(13)
ser.write(out.encode('ascii'))
print(out)

print('SENDING ' + str(ign_val))
out = 'T1021' + ('07' if ign_val else '06') + chr(13)
ser.write(out.encode('ascii'))
print(out)

time.sleep(0.25)

threading.Thread(target=rec).start()
Expand Down

0 comments on commit 8e1d1f6

Please sign in to comment.