aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2018-03-23 10:02:35 +1100
committerBen V. Brown <[email protected]>2018-03-23 10:02:35 +1100
commit85869d507e744797c732668ac989478f0869021c (patch)
tree6aa4c6a9bd4d1fd4e823e1a03cf7e527e7214e72
parent6c346750833d163862e7231abfdd148c7974e8c9 (diff)
downloadIronOS-85869d507e744797c732668ac989478f0869021c.tar.gz
IronOS-85869d507e744797c732668ac989478f0869021c.zip
Add lockouts for no accel
-rw-r--r--workspace/TS100/src/main.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp
index 8fc76c1b..6b7f58fe 100644
--- a/workspace/TS100/src/main.cpp
+++ b/workspace/TS100/src/main.cpp
@@ -52,11 +52,16 @@ int main(void) {
PCBVersion = 1;
accel.initalize(); // this sets up the I2C registers and loads up the default
// settings
- } else {
+ } else if (HAL_I2C_Mem_Read(&hi2c1, 25 << 1, 0x0F, I2C_MEMADD_SIZE_8BIT,
+ buffer, 1, 1000) == HAL_OK) {
PCBVersion = 2;
//Setup the ST Accelerometer
accel2.initalize(); //startup the accelerometer
}
+ {
+ PCBVersion = 3;
+
+ }
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
setCalibrationOffset(systemSettings.CalibrationOffset);
@@ -920,12 +925,16 @@ void startMOVTask(void const *argument) {
uint32_t max = 0;
#endif
+ if (PCBVersion == 3) {
+ for (;;)
+ osDelay(5000);
+ }
for (;;) {
int32_t threshold = 1200 + (9 * 200);
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
if (PCBVersion == 2)
accel2.getAxisReadings(&tx, &ty, &tz);
- else
+ else if (PCBVersion == 1)
accel.getAxisReadings(&tx, &ty, &tz);
datax[currentPointer] = (int32_t) tx;
@@ -992,6 +1001,11 @@ void startRotationTask(void const *argument) {
* This task is used to manage rotation of the LCD screen & button re-mapping
*
*/
+ if(PCBVersion==3)
+ {
+ for(;;)
+ osDelay(5000);
+ }
switch (systemSettings.OrientationMode) {
case 0:
lcd.setRotation(false);
@@ -1013,7 +1027,7 @@ void startRotationTask(void const *argument) {
uint8_t rotation;
if (PCBVersion == 2) {
rotation = accel2.getOrientation();
- } else {
+ } else if (PCBVersion == 1) {
rotation = accel.getOrientation();
}
if (systemSettings.OrientationMode == 2) {