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:
- 158:059abeb44ba1
- Parent:
- 157:1a100a5ed06f
- Child:
- 159:577e9d015693
--- a/main.cpp Wed Oct 30 03:16:51 2013 +0000
+++ b/main.cpp Thu Oct 31 14:41:24 2013 +0000
@@ -5,15 +5,14 @@
// * Add linear efficiency graph with 10 minute values
// * Subtract accessory power from efficiency history (add back in when displaying)
// * Add in-device config editor
-// * Store efficiency data at different temperatures
// * Change pack volt color when CVLI fails
// * Add tire pressure cal (40psi for me = FR 38, RR 38.2, FL 37.8, RL 38 - maybe 2psi error on my tire gauge?)
// * Add heater activation warning message
-
-// rev157
-// Added trip max/min efficiency reset
-// Added second config screen and RegenMon enable/disable
+// rev158
+// Fixed bug in date/time sync to sync on all days of the month
+// Added auto time sync enable/disable button to cofig2 screen
+// Highlighted row if data changed in testScreen
#include "mbed.h"
#include "CAN.h"
@@ -23,7 +22,7 @@
#include "utility.h"
#include "displayModes.h"
#include "TOUCH_TFTx2.h"
-char revStr[7] = "157"; // gg - revision string, max 6 characters
+char revStr[7] = "158"; // gg - revision string, max 6 characters
FATFS USBdrive;
LocalFileSystem local("local");
@@ -127,8 +126,8 @@
float kWh_trip[3]={0};
float miles_trip[3]={0};
float curEff = 0;
-float maxTripEff = 4;
-float minTripEff = 4;
+float maxTripEff = 0;
+float minTripEff = 5;
float mph[39]={0};
float kW[39]={0};
float mpkWh[39]={0};
@@ -158,6 +157,7 @@
unsigned short modelYear = 2011;
bool idir, lidir;
bool enableSound=false;
+bool clearTest=true;
int main() {
char sTemp[40];
@@ -464,8 +464,8 @@
} else if (dMode[whichTouched]==configScreen) {
mbed_reset();
} else if (dMode[whichTouched]==config2Screen) { // reset DTE Max/Min
- maxTripEff = 4;
- minTripEff = 4;
+ maxTripEff = 0;
+ minTripEff = 5;
} else if (dMode[whichTouched]==playbackScreen) { // pause/unpause
playbackEn=!playbackEn;
if(playbackEn){
@@ -517,7 +517,9 @@
} else if (dMode[whichTouched] == indexScreen) { // gg - index
dMode[whichTouched] = healthScreen ; // Goto health screen
sMode=0;
- } else {
+ } else if (dMode[whichTouched] == testScreen) { // gg - index
+ clearTest=true;
+ } else { // top-right corner always mute/unmute unless used by specific screen
enableSound = !enableSound;
if(!enableSound) spkr=0;
}
@@ -631,23 +633,25 @@
}else{
geiger.detach();
}
+ } else if (dMode[whichTouched]==config2Screen) {
+ autoSync = !autoSync;
} else {
lastDMode[whichTouched]=99;//repaint to clear highlight
}
break;
case 12: // left-middle col, bottom row (not nav)
- if (dMode[whichTouched] == config2Screen) { // gg - index
+ if (dMode[whichTouched]==configScreen) {
+ regenMon = !regenMon;
+ } else if (dMode[whichTouched]==config2Screen) { // gg - index
dMode[whichTouched] = dateScreen ; // GoTo Set Date/Time Screen
- } else if (dMode[whichTouched]==configScreen) {
- regenMon = !regenMon;
} else {
lastDMode[whichTouched]=99;//repaint to clear highlight
}
break;
case 22: // right-middle col, bottom row (not nav)
- if (dMode[whichTouched] == indexScreen) { // gg - index
+ if (dMode[whichTouched]==indexScreen) { // gg - index
dMode[whichTouched] = logScreen ;
} else if (dMode[whichTouched]==config2Screen) {
showHealth = !showHealth;
@@ -657,15 +661,15 @@
break;
case 32: // right col, bottom row (not nav)
- if (dMode[whichTouched] == config2Screen) {
+ if (dMode[whichTouched]==config2Screen) {
logEn=false;
updateFirmware();
- } else if (dMode[whichTouched] == tripScreen) {
+ } else if (dMode[whichTouched]==tripScreen) {
miles_trip[2]=0;
kWh_trip[2]=0;
sMode=0;
lastDMode[whichTouched]=99;//repaint to clear highlight
- } else if (dMode[whichTouched] == indexScreen) {
+ } else if (dMode[whichTouched]==indexScreen) {
dMode[whichTouched] = tripScreen ;
} else if (dMode[whichTouched]==dateScreen){
autoSync=!autoSync; // toggle autoSync mode
@@ -757,7 +761,7 @@
userIdle=false;
}
// Keep track of max and min trip efficiency
- if (miles_trip[0]>3){ // Ignore very short trips
+ if (miles_trip[0]>5){ // Ignore short trips
if (maxTripEff<curEff) {
maxTripEff=curEff;
}
