test fork
Dependencies: SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary_9341 by
Revision 104:5a19101aaac5, committed 2013-06-28
- Comitter:
- TickTock
- Date:
- Fri Jun 28 00:11:41 2013 +0000
- Branch:
- Metric
- Parent:
- 103:1389e9efe8c3
- Child:
- 105:2da2d9378c57
- Commit message:
- Fixed 000 msgId logging bug
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
utility.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jun 20 23:07:27 2013 +0000 +++ b/main.cpp Fri Jun 28 00:11:41 2013 +0000 @@ -12,10 +12,8 @@ // * Add coasting regen to regen/braking display // * Change semilog efficiency graph to linear with 10 minute values // * Add Trip meter (kWh and efficiency for current trip) -// * Make unique sound when log file write fails and logging disabled // * Make display updates interruptable for log writes // * Add additional 79b bank readouts -// * Ignore the missing 4th pemperature sensor on 2013 models // * Add ability to transfer settings config file to/from USB // * Add once-on-powerup/powerdown log // * Move log dump to ISR (but CAN RX at higher priority) @@ -30,7 +28,7 @@ #include "displayModes.h" #include "TOUCH_TFTx2.h" -char revStr[7] = "100"; +char revStr[7] = "103"; LocalFileSystem local("local"); @@ -297,7 +295,10 @@ logOpen = false; sprintf(sTemp,"Failed to append log file.\n"); printMsg(sTemp); // failed to append - spkr.beep(1000,0.25); + spkr.beep(3000,0.25); + spkr.beep(1500,0.25); + spkr.beep(750,0.25); + spkr.beep(375,0.25); logEn=false; } else { while (readPointer != writePointer) {
--- a/utility.cpp Thu Jun 20 23:07:27 2013 +0000 +++ b/utility.cpp Fri Jun 28 00:11:41 2013 +0000 @@ -149,30 +149,32 @@ } }else{ // not debugMode - keep code short if(logOpen){ - NVIC_DisableIRQ(CAN_IRQn); // Block interrupts until write pointer assigned - int localWritePointer = writePointer++; // create local copy to make logCan reentrant - // note that the static variables do not prevent safe reentry - // since they are only used for msgId<0x800 which will never interrupt - // another msgId<0x800 (both CANbusses are same priority) - if (writePointer >= maxBufLen) { - writePointer = 0; - led3 = !led3; - } - NVIC_EnableIRQ(CAN_IRQn); // Unblock interrupts once local pointer set and global pointer incremented - ts=getTimeStamp(); - writeBuffer[localWritePointer][0]=mType; - writeBuffer[localWritePointer][1]=(ts&0xff00)>>8; - writeBuffer[localWritePointer][2]=(ts&0x00ff); - writeBuffer[localWritePointer][3]=canRXmsg.id&0xff; - writeBuffer[localWritePointer][4]=(canRXmsg.id>>8)+(canRXmsg.len<<4); - for(i=5;i<13;i++){ // Is there a better way to do this? (writeBuffer[localWritePointer][5]=canRXmsg.data?) - writeBuffer[localWritePointer][i]=canRXmsg.data[i-5]; - } - if (writePointer==readPointer) { - // Just caught up to read pointer - sprintf(sTemp,"Write buffer overrun.\n"); - printMsg(sTemp); // write buffer overrun - spkr.beep(500,0.25); + if(canRXmsg.id>0) { + NVIC_DisableIRQ(CAN_IRQn); // Block interrupts until write pointer assigned + int localWritePointer = writePointer++; // create local copy to make logCan reentrant + // note that the static variables do not prevent safe reentry + // since they are only used for msgId<0x800 which will never interrupt + // another msgId<0x800 (both CANbusses are same priority) + if (writePointer >= maxBufLen) { + writePointer = 0; + led3 = !led3; + } + NVIC_EnableIRQ(CAN_IRQn); // Unblock interrupts once local pointer set and global pointer incremented + ts=getTimeStamp(); + writeBuffer[localWritePointer][0]=mType; + writeBuffer[localWritePointer][1]=(ts&0xff00)>>8; + writeBuffer[localWritePointer][2]=(ts&0x00ff); + writeBuffer[localWritePointer][3]=canRXmsg.id&0xff; + writeBuffer[localWritePointer][4]=(canRXmsg.id>>8)+(canRXmsg.len<<4); + for(i=5;i<13;i++){ // Is there a better way to do this? (writeBuffer[localWritePointer][5]=canRXmsg.data?) + writeBuffer[localWritePointer][i]=canRXmsg.data[i-5]; + } + if (writePointer==readPointer) { + // Just caught up to read pointer + sprintf(sTemp,"Write buffer overrun.\n"); + printMsg(sTemp); // write buffer overrun + spkr.beep(500,0.25); + } } } }