1
0
forked from me/IronOS

1.13 alpha, testing new sensitivity & alternate button layout

This commit is contained in:
Ben V. Brown
2017-07-12 20:18:20 +10:00
parent 5802a254d0
commit f844200b1b
4 changed files with 12 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ enum {
TEMPCAL, //Cal tip temp offset TEMPCAL, //Cal tip temp offset
} operatingMode; } operatingMode;
#define SETTINGSOPTIONSCOUNT 11 /*Number of settings in the settings menu*/ #define SETTINGSOPTIONSCOUNT 10 /*Number of settings in the settings menu*/
enum { enum {
UVCO = 0, UVCO = 0,

View File

@@ -34,13 +34,13 @@ 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 = 9*7+1; uint8_t sens = 9 * 7 + 5;
sens -= 7 * sensitivity; sens -= 7 * sensitivity;
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold I2C_RegisterWrite(FF_MT_THS_REG, 0x80 | sens); // Set threshold
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms I2C_RegisterWrite(FF_MT_COUNT_REG, 0x02); // Set debounce to 100ms
I2C_RegisterWrite( CTRL_REG4, 0x04); // Enable motion interrupt I2C_RegisterWrite( CTRL_REG4, 0x04); // Enable motion interrupt
I2C_RegisterWrite( CTRL_REG5, 0x04);// Route motion interrupts to INT1 ->PB5 ->EXTI5 I2C_RegisterWrite( CTRL_REG5, 0x04);// Route motion interrupts to INT1 ->PB5 ->EXTI5
I2C_RegisterWrite( CTRL_REG1, 0x19); // ODR=100 Hz, Active mode I2C_RegisterWrite( CTRL_REG1, 0x11); // ODR=800 Hz, Active mode
} }

View File

@@ -18,6 +18,10 @@ int main(void) {
ProcessUI(); ProcessUI();
DrawUI(); DrawUI();
delayMs(50); //Slow the system down a little bit delayMs(50); //Slow the system down a little bit
if(GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_5)==Bit_RESET)
{
lastMovement = millis();
}
} }
} }
void setup() { void setup() {
@@ -37,7 +41,7 @@ void setup() {
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
Init_Oled(systemSettings.flipDisplay); //Init the OLED display Init_Oled(systemSettings.flipDisplay); //Init the OLED display
OLED_DrawString("VER 1.12", 8); //Version Number OLED_DrawString("VER 1.13", 8); //Version Number
delayMs(500); //Pause to show version number delayMs(500); //Pause to show version number
Start_Watchdog(1000); //start the system watch dog as 1 second timeout Start_Watchdog(1000); //start the system watch dog as 1 second timeout
} }

View File

@@ -131,7 +131,7 @@ void ProcessUI() {
//The user pressed the button to breakout of the settings help prompt //The user pressed the button to breakout of the settings help prompt
StatusFlags = 0; StatusFlags = 0;
} else { } else {
if (Buttons & BUT_A) { if (Buttons & BUT_B) {
//A key iterates through the menu //A key iterates through the menu
if (settingsPage == SETTINGSOPTIONSCOUNT) { if (settingsPage == SETTINGSOPTIONSCOUNT) {
//Roll off the end //Roll off the end
@@ -141,7 +141,7 @@ void ProcessUI() {
} else { } else {
++settingsPage; //move to the next option ++settingsPage; //move to the next option
} }
} else if (Buttons & BUT_B) { } else if (Buttons & BUT_A) {
//B changes the value selected //B changes the value selected
switch (settingsPage) { switch (settingsPage) {
case UVCO: case UVCO: