Bugfix sensitivity options typo + add more options
Changes sensitivity scale to be more precise. Fixes #17
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "stm32f10x_flash.h"
|
#include "stm32f10x_flash.h"
|
||||||
#define SETTINGSVERSION 10 /*Change this if you change the struct below to prevent people getting out of sync*/
|
#define SETTINGSVERSION 11 /*Change this if you change the struct below to prevent people getting out of sync*/
|
||||||
//Motion Sensitivity
|
//Motion Sensitivity
|
||||||
#define MOTION_HIGH (0x00)
|
#define MOTION_HIGH (0x00)
|
||||||
#define MOTION_MED (0x01)
|
#define MOTION_MED (0x01)
|
||||||
@@ -37,7 +37,7 @@ struct {
|
|||||||
uint8_t movementEnabled:1; //If movement is enabled
|
uint8_t movementEnabled:1; //If movement is enabled
|
||||||
uint8_t displayTempInF:1; //If we need to convert the C reading to F
|
uint8_t displayTempInF:1; //If we need to convert the C reading to F
|
||||||
uint8_t flipDisplay:1; //If true we want to invert the display for lefties
|
uint8_t flipDisplay:1; //If true we want to invert the display for lefties
|
||||||
uint8_t sensitivity:5; //Sensitivity of accelerometer
|
uint8_t sensitivity:5; //Sensitivity of accelerometer (4 bits)
|
||||||
uint8_t ShutdownTime:6; //Time until unit shuts down if left alone
|
uint8_t ShutdownTime:6; //Time until unit shuts down if left alone
|
||||||
uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode
|
uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode
|
||||||
uint8_t temperatureRounding:2; //Rounding mode for the temperature
|
uint8_t temperatureRounding:2; //Rounding mode for the temperature
|
||||||
|
|||||||
@@ -34,19 +34,8 @@ void StartUp_Accelerometer(uint8_t sensitivity) {
|
|||||||
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
||||||
delayMs(2); // ~1ms delay
|
delayMs(2); // ~1ms delay
|
||||||
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
||||||
uint8_t sens =0x0F;
|
uint8_t sens = 0x3F;
|
||||||
switch(sensitivity)
|
sens -= 0x08 * sensitivity;
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
sens=0x1A;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
sens=0x20;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
sens=0x2A;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold
|
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold
|
||||||
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
|
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
||||||
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
||||||
" Shutdown Timeout <Minutes>", " Motion Detection",
|
" Shutdown Timeout <Minutes>", " Motion Detection",
|
||||||
" Motion Sensitivity", " Temperature Unit",
|
" Motion Sensitivity <1.least sensitive 8.most sensitive>",
|
||||||
" Temperature Rounding Amount",
|
" Temperature Unit", " Temperature Rounding Amount",
|
||||||
" Temperature Display Update Rate",
|
" Temperature Display Update Rate",
|
||||||
" Flip Display for Left Hand",
|
" Flip Display for Left Hand",
|
||||||
" Enable front key boost 450C mode when soldering",
|
" Enable front key boost 450C mode when soldering",
|
||||||
" Temperature when in boost mode" };
|
" Temperature when in boost mode" };
|
||||||
const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 22, 24, 22, 33, 37,
|
const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 22, 61, 22, 33, 37,
|
||||||
32, 53, 36 };
|
32, 53, 36 };
|
||||||
uint8_t StatusFlags = 0;
|
uint8_t StatusFlags = 0;
|
||||||
uint32_t temporaryTempStorage = 0;
|
uint32_t temporaryTempStorage = 0;
|
||||||
@@ -177,7 +177,7 @@ void ProcessUI() {
|
|||||||
break;
|
break;
|
||||||
case MOTIONSENSITIVITY:
|
case MOTIONSENSITIVITY:
|
||||||
systemSettings.sensitivity++;
|
systemSettings.sensitivity++;
|
||||||
systemSettings.sensitivity = systemSettings.sensitivity % 3;
|
systemSettings.sensitivity = systemSettings.sensitivity % 8;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TEMPROUNDING:
|
case TEMPROUNDING:
|
||||||
@@ -503,21 +503,8 @@ void DrawUI() {
|
|||||||
OLED_DrawString("FLPDSP F", 8);
|
OLED_DrawString("FLPDSP F", 8);
|
||||||
break;
|
break;
|
||||||
case MOTIONSENSITIVITY:
|
case MOTIONSENSITIVITY:
|
||||||
switch (systemSettings.sensitivity) {
|
OLED_DrawString("MSENSE ", 7);
|
||||||
case MOTION_HIGH:
|
OLED_DrawChar('1' + systemSettings.sensitivity, 7);
|
||||||
OLED_DrawString("SENSE H ", 8);
|
|
||||||
break;
|
|
||||||
case MOTION_MED:
|
|
||||||
OLED_DrawString("SENSE M ", 8);
|
|
||||||
break;
|
|
||||||
case MOTION_LOW:
|
|
||||||
OLED_DrawString("SENSE L ", 8);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
OLED_DrawString("SENSE ", 8);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TEMPROUNDING:
|
case TEMPROUNDING:
|
||||||
//We are prompting the user about their display mode preferences
|
//We are prompting the user about their display mode preferences
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void resetSettings() {
|
|||||||
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
||||||
systemSettings.displayTempInF =0; //default to C
|
systemSettings.displayTempInF =0; //default to C
|
||||||
systemSettings.flipDisplay=0; //Default to right handed mode
|
systemSettings.flipDisplay=0; //Default to right handed mode
|
||||||
systemSettings.sensitivity=0x00; //Default high sensitivity
|
systemSettings.sensitivity=5; //Default high sensitivity
|
||||||
systemSettings.tempCalibration=239; //Default to their calibration value
|
systemSettings.tempCalibration=239; //Default to their calibration value
|
||||||
systemSettings.voltageDiv=144; //Default divider from schematic
|
systemSettings.voltageDiv=144; //Default divider from schematic
|
||||||
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off
|
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off
|
||||||
|
|||||||
Reference in New Issue
Block a user