Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed
Fork of CANary by
Diff: main.cpp
- Revision:
- 39:eef8beac7411
- Parent:
- 38:155ec32c5e91
- Child:
- 40:0e6e71a7323f
--- a/main.cpp Sun Mar 24 17:26:09 2013 +0000
+++ b/main.cpp Mon Mar 25 15:13:15 2013 +0000
@@ -1,6 +1,7 @@
// main.cpp
//To Do:
+// * Use timestamp for mWs but override with playbackInt based calc in playback
// * Log file playback (to enable testing of new passive display modes without having to drive around)
// * USB device detect
// * Ability to update binary from the thumb-drive (requires file timestamp)
@@ -75,6 +76,7 @@
unsigned char indexOffset = 1;
bool showCP = false;
bool pollCP = false;
+bool logCP = false; //Turbo3
bool repeatPoll = false;
bool headlights = false;
bool tick = false;
@@ -93,7 +95,7 @@
bool step = false;
char header[5];
char data[8];
-unsigned short pbts;
+//unsigned short pbts;
int main() {
int readPointer=0;
@@ -446,18 +448,7 @@
lastDMode[1]=99;
}
}
- display=display<1?display+1:0; // toggle display
- updateDisplay(display);
- if(pollCP){ // We do this inside main loop instead of ticker so CAN RX will not be blocked
- sendCPreq(); // send cellpair data request.
- wait_ms(16);
- sendTreq(); //send temperature request
- wait_ms(16);
- showCP=true;
- pollCP=false;
- }
-
if(tick){ // Executes once a second
accV=mon12V*scale12V;
accOn=(accV>5)?true:false;
@@ -476,9 +467,22 @@
}
miles=0;
mWs=0;
+ if(logCP) logPackVoltages(); // Turbo3
tick=false;
}
+ display=display<1?display+1:0; // toggle display
+ updateDisplay(display);
+
+ if(pollCP){ // We do this inside main loop instead of ticker so CAN RX will not be blocked
+ sendCPreq(); // send cellpair data request.
+ wait_ms(16);
+ sendTreq(); //send temperature request
+ wait_ms(16);
+ showCP=true;
+ pollCP=false;
+ }
+
if(step){ // playback
if(playbackOpen&&playbackEn){
//sprintf(sTemp,"step\n");
@@ -486,7 +490,7 @@
for(i=0;i<120;i++){
if(!feof(file)){
fscanf(file,"%5c%8c",&header,&data);
- pbts=(header[1]<<8)|header[2];
+ //pbts=(header[1]<<8)|header[2];
logCan(header[0],CANMessage(0x7ff&((header[4]<<8)+header[3]), data, 8));
}else{
fclose(file); // restart
