From da43b4ee001ea3152e0ab51479a5d1bd2556e209 Mon Sep 17 00:00:00 2001
From: nrs1g15 <nrs1g15@soton.ac.uk>
Date: Sat, 27 Jul 2019 13:15:51 +0100
Subject: [PATCH] Added a easy debug mode switch for lower thresholds to use
 tps as testing input data

---
 sufst-dash/.idea/workspace.xml | 84 +++++++++++-----------------------
 sufst-dash/sufst-dash.ino      | 21 +++++++++
 2 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/sufst-dash/.idea/workspace.xml b/sufst-dash/.idea/workspace.xml
index e860881..23f981a 100644
--- a/sufst-dash/.idea/workspace.xml
+++ b/sufst-dash/.idea/workspace.xml
@@ -10,47 +10,15 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="d82c796c-eb6b-44b1-bc58-6a762ff3ba9a" name="Default Changelist" comment="">
-      <change afterPath="$PROJECT_DIR$/../sufst-controller/daq.cpp" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../sufst-controller/daq.h" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../sufst-controller/sd.cpp" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../sufst-controller/sd.h" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-can-sd-xbee/sufst-can-sd-xbee.ino" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-controller/dashController.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/dashController.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-controller/ecuCan.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/ecuCan.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-controller/ecuOpenloggerTags.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-controller/openLoggerController.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-controller/openLoggerController.h" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/can.h" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/can.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/crc8.c" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/crc8.c" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/daq.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/daq.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/sd.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/sd.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../sufst-controller/sd.h" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/sd.h" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/../sufst-controller/sufst-controller.ino" beforeDir="false" afterPath="$PROJECT_DIR$/../sufst-controller/sufst-controller.ino" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/sufst-dash.ino" beforeDir="false" afterPath="$PROJECT_DIR$/sufst-dash.ino" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/codeStyles/Project.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/codeStyles/codeStyleConfig.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/misc.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/modules.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/sufst-openlogger.iml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/vcs.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/.idea/workspace.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/buffer.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/buffer.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/openLogger.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/openLogger.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger/sufst-openlogger.ino" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/codeStyles/Project.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/codeStyles/codeStyleConfig.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/misc.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/modules.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/sufst-openlogger_controller.iml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/vcs.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/.idea/workspace.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/buffer.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/buffer.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/can.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/can.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/ecuCan.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/ecuCan.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/ecuOpenloggerTags.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/openLoggerController.cpp" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/openLoggerController.h" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../sufst-openlogger_controller/sufst-openlogger_controller.ino" beforeDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -66,8 +34,12 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/sufst-dash.ino">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="172">
-              <caret line="271" column="22" selection-start-line="271" selection-start-column="22" selection-end-line="271" selection-end-column="22" />
+            <state relative-caret-position="493">
+              <caret line="47" selection-start-line="47" selection-end-line="47" />
+              <folding>
+                <element signature="e#659#889#0" expanded="true" />
+                <element signature="e#11028#11105#0" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
@@ -84,19 +56,10 @@
       </list>
     </option>
   </component>
-  <component name="ProjectConfigurationFiles">
-    <option name="files">
-      <list>
-        <option value="$PROJECT_DIR$/.idea/sufst-dash.iml" />
-        <option value="$PROJECT_DIR$/.idea/misc.xml" />
-        <option value="$PROJECT_DIR$/.idea/vcs.xml" />
-        <option value="$PROJECT_DIR$/.idea/modules.xml" />
-      </list>
-    </option>
-  </component>
-  <component name="ProjectFrameBounds" extendedState="6">
-    <option name="width" value="960" />
-    <option name="height" value="1030" />
+  <component name="ProjectFrameBounds" extendedState="7">
+    <option name="x" value="476" />
+    <option name="width" value="1453" />
+    <option name="height" value="1038" />
   </component>
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
   <component name="ProjectView">
@@ -119,6 +82,7 @@
     </panes>
   </component>
   <component name="PropertiesComponent">
+    <property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="node.js.detected.package.eslint" value="true" />
@@ -152,12 +116,12 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1564151489030</updated>
-      <workItem from="1564151490369" duration="1208000" />
+      <workItem from="1564151490369" duration="3455000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1208000" />
+    <option name="totallyTimeSpent" value="3455000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
@@ -189,8 +153,12 @@
   <component name="editorHistoryManager">
     <entry file="file://$PROJECT_DIR$/sufst-dash.ino">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="172">
-          <caret line="271" column="22" selection-start-line="271" selection-start-column="22" selection-end-line="271" selection-end-column="22" />
+        <state relative-caret-position="493">
+          <caret line="47" selection-start-line="47" selection-end-line="47" />
+          <folding>
+            <element signature="e#659#889#0" expanded="true" />
+            <element signature="e#11028#11105#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
diff --git a/sufst-dash/sufst-dash.ino b/sufst-dash/sufst-dash.ino
index 9bb6b56..9563567 100644
--- a/sufst-dash/sufst-dash.ino
+++ b/sufst-dash/sufst-dash.ino
@@ -1,5 +1,7 @@
 #include "checksum.h"
 
+#define DEBUG_DASH 0
+
 #define DASH_RPM_LED_RED_1_PIN 2
 #define DASH_RPM_LED_RED_2_PIN 4
 #define DASH_RPM_LED_GREEN_1_PIN 6
@@ -22,6 +24,18 @@
 
 #define DASH_SERIAL_START_BYTE 0x55
 
+#if DEBUG_DASH
+#define DASH_RPM_THRESHOLD_1 30
+#define DASH_RPM_THRESHOLD_2 40
+#define DASH_RPM_THRESHOLD_3 50
+#define DASH_RPM_THRESHOLD_4 60
+#define DASH_RPM_THRESHOLD_5 70
+#define DASH_RPM_THRESHOLD_SHIFT 80
+
+#define DASH_WATER_C_THRESHOLD 70
+
+#else
+
 #define DASH_RPM_THRESHOLD_1 7000
 #define DASH_RPM_THRESHOLD_2 9000
 #define DASH_RPM_THRESHOLD_3 11000
@@ -30,6 +44,7 @@
 #define DASH_RPM_THRESHOLD_SHIFT 13500
 
 #define DASH_WATER_C_THRESHOLD 100
+#endif // DEBUG_DASH
 
 void dashRpmLedsBegin();
 void dashRpmLedsProcess();
@@ -305,7 +320,13 @@ void serialProcess()
 
                 if (Serial.read() == crc_8(receivedData.data, 4)) {
                     gDashWaterTemp = receivedData.waterTempC;
+
                     gDashRpm = receivedData.rpm;
+
+#if DEBUG_DASH
+                    Serial.println(gDashRpm);
+                    Serial.println(gDashWaterTemp);
+#endif // DEBUG_DASH
                 }
 
                 dashSerialState = checkStart;
-- 
GitLab