|
|
|
|
@@ -109,16 +109,18 @@ ButtonState getButtonState() {
|
|
|
|
|
static uint32_t previousStateChange = 0;
|
|
|
|
|
const uint16_t timeout = 400;
|
|
|
|
|
uint8_t currentState;
|
|
|
|
|
currentState =
|
|
|
|
|
(HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0)
|
|
|
|
|
<< 0;
|
|
|
|
|
currentState |=
|
|
|
|
|
(HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0)
|
|
|
|
|
<< 1;
|
|
|
|
|
currentState = (
|
|
|
|
|
HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ?
|
|
|
|
|
1 : 0) << 0;
|
|
|
|
|
currentState |= (
|
|
|
|
|
HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ?
|
|
|
|
|
1 : 0) << 1;
|
|
|
|
|
|
|
|
|
|
if (currentState) lastButtonTime = HAL_GetTick();
|
|
|
|
|
if (currentState)
|
|
|
|
|
lastButtonTime = HAL_GetTick();
|
|
|
|
|
if (currentState == previousState) {
|
|
|
|
|
if (currentState == 0) return BUTTON_NONE;
|
|
|
|
|
if (currentState == 0)
|
|
|
|
|
return BUTTON_NONE;
|
|
|
|
|
if ((HAL_GetTick() - previousStateChange) > timeout) {
|
|
|
|
|
// User has been holding the button down
|
|
|
|
|
// We want to send a buttong is held message
|
|
|
|
|
@@ -180,8 +182,10 @@ void waitForButtonPressOrTimeout(uint32_t timeout) {
|
|
|
|
|
// Make timeout our exit value
|
|
|
|
|
for (;;) {
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
if (buttons) return;
|
|
|
|
|
if (HAL_GetTick() > timeout) return;
|
|
|
|
|
if (buttons)
|
|
|
|
|
return;
|
|
|
|
|
if (HAL_GetTick() > timeout)
|
|
|
|
|
return;
|
|
|
|
|
GUIDelay();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -197,9 +201,11 @@ static bool checkVoltageForExit() {
|
|
|
|
|
lcd.print(UndervoltageString);
|
|
|
|
|
lcd.setCursor(0, 8);
|
|
|
|
|
lcd.print(InputVoltageString);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
|
|
|
|
2);
|
|
|
|
|
lcd.drawChar('.');
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
|
|
|
|
1);
|
|
|
|
|
lcd.print("V");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -219,12 +225,15 @@ static void gui_drawBatteryIcon() {
|
|
|
|
|
// User is on a lithium battery
|
|
|
|
|
// we need to calculate which of the 10 levels they are on
|
|
|
|
|
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
|
|
|
|
uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv) / cellCount;
|
|
|
|
|
uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv)
|
|
|
|
|
/ cellCount;
|
|
|
|
|
// Should give us approx cell voltage X10
|
|
|
|
|
// Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
|
|
|
|
if (cellV < 33) cellV = 33;
|
|
|
|
|
if (cellV < 33)
|
|
|
|
|
cellV = 33;
|
|
|
|
|
cellV -= 33; // Should leave us a number of 0-9
|
|
|
|
|
if (cellV > 9) cellV = 9;
|
|
|
|
|
if (cellV > 9)
|
|
|
|
|
cellV = 9;
|
|
|
|
|
lcd.drawBattery(cellV + 1);
|
|
|
|
|
} else
|
|
|
|
|
lcd.drawSymbol(16); // Draw the DC Logo
|
|
|
|
|
@@ -237,7 +246,8 @@ static void gui_solderingTempAdjust() {
|
|
|
|
|
lcd.clearScreen();
|
|
|
|
|
lcd.setFont(0);
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
if (buttons) lastChange = HAL_GetTick();
|
|
|
|
|
if (buttons)
|
|
|
|
|
lastChange = HAL_GetTick();
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_NONE:
|
|
|
|
|
// stay
|
|
|
|
|
@@ -282,7 +292,8 @@ static void gui_solderingTempAdjust() {
|
|
|
|
|
if (systemSettings.SolderingTemp < 120)
|
|
|
|
|
systemSettings.SolderingTemp = 120;
|
|
|
|
|
} else {
|
|
|
|
|
if (systemSettings.SolderingTemp < 50) systemSettings.SolderingTemp = 50;
|
|
|
|
|
if (systemSettings.SolderingTemp < 50)
|
|
|
|
|
systemSettings.SolderingTemp = 50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (HAL_GetTick() - lastChange > 1500)
|
|
|
|
|
@@ -306,8 +317,8 @@ static void gui_settingsMenu() {
|
|
|
|
|
uint32_t autoRepeatTimer = 0;
|
|
|
|
|
bool earlyExit = false;
|
|
|
|
|
uint32_t descriptionStart = 0;
|
|
|
|
|
while ((settingsMenu[currentScreen].incrementHandler.func != NULL) &&
|
|
|
|
|
earlyExit == false) {
|
|
|
|
|
while ((settingsMenu[currentScreen].incrementHandler.func != NULL)
|
|
|
|
|
&& earlyExit == false) {
|
|
|
|
|
lcd.setFont(0);
|
|
|
|
|
lcd.clearScreen();
|
|
|
|
|
lcd.setCursor(0, 0);
|
|
|
|
|
@@ -318,8 +329,10 @@ static void gui_settingsMenu() {
|
|
|
|
|
} else {
|
|
|
|
|
// Draw description
|
|
|
|
|
// draw string starting from descriptionOffset
|
|
|
|
|
int16_t maxOffset = strlen(settingsMenu[currentScreen].description) + 7;
|
|
|
|
|
if (descriptionStart == 0) descriptionStart = HAL_GetTick();
|
|
|
|
|
int16_t maxOffset = strlen(settingsMenu[currentScreen].description)
|
|
|
|
|
+ 7;
|
|
|
|
|
if (descriptionStart == 0)
|
|
|
|
|
descriptionStart = HAL_GetTick();
|
|
|
|
|
|
|
|
|
|
int16_t descriptionOffset =
|
|
|
|
|
(((HAL_GetTick() - descriptionStart) / 3) % (maxOffset * 12));
|
|
|
|
|
@@ -407,7 +420,8 @@ static int gui_showTipTempWarning() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (systemSettings.coolingTempBlink && tipTemp > 70) {
|
|
|
|
|
if (HAL_GetTick() % 500 < 250) lcd.clearScreen();
|
|
|
|
|
if (HAL_GetTick() % 500 < 250)
|
|
|
|
|
lcd.clearScreen();
|
|
|
|
|
}
|
|
|
|
|
lcd.refresh();
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
@@ -416,10 +430,12 @@ static int gui_showTipTempWarning() {
|
|
|
|
|
else if (buttons == BUTTON_B_SHORT || buttons == BUTTON_BOTH)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (tipTemp < 50) return 0;//Exit the warning screen
|
|
|
|
|
if (tipTemp < 50)
|
|
|
|
|
return 0; //Exit the warning screen
|
|
|
|
|
|
|
|
|
|
GUIDelay();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
static uint16_t min(uint16_t a, uint16_t b) {
|
|
|
|
|
if (a > b)
|
|
|
|
|
@@ -432,18 +448,22 @@ static int gui_SolderingSleepingMode() {
|
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
if (buttons) return 0;
|
|
|
|
|
if ((HAL_GetTick() - lastMovementTime < 1000) ||
|
|
|
|
|
(HAL_GetTick() - lastButtonTime < 1000))
|
|
|
|
|
if (buttons)
|
|
|
|
|
return 0;
|
|
|
|
|
if ((HAL_GetTick() - lastMovementTime < 1000)
|
|
|
|
|
|| (HAL_GetTick() - lastButtonTime < 1000))
|
|
|
|
|
return 0; // user moved or pressed a button, go back to soldering
|
|
|
|
|
if (checkVoltageForExit()) return 1; // return non-zero on error
|
|
|
|
|
if (checkVoltageForExit())
|
|
|
|
|
return 1; // return non-zero on error
|
|
|
|
|
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
|
|
|
|
min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
|
|
|
|
min(systemSettings.SleepTemp,
|
|
|
|
|
systemSettings.SolderingTemp));
|
|
|
|
|
else
|
|
|
|
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
|
|
|
|
min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
|
|
|
|
min(systemSettings.SleepTemp,
|
|
|
|
|
systemSettings.SolderingTemp));
|
|
|
|
|
// draw the lcd
|
|
|
|
|
uint16_t tipTemp;
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
@@ -465,9 +485,11 @@ static int gui_SolderingSleepingMode() {
|
|
|
|
|
lcd.print("C");
|
|
|
|
|
|
|
|
|
|
lcd.print(" ");
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
|
|
|
|
2);
|
|
|
|
|
lcd.drawChar('.');
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
|
|
|
|
1);
|
|
|
|
|
lcd.drawChar('V');
|
|
|
|
|
} else {
|
|
|
|
|
lcd.setFont(0);
|
|
|
|
|
@@ -480,8 +502,8 @@ static int gui_SolderingSleepingMode() {
|
|
|
|
|
}
|
|
|
|
|
if (systemSettings.ShutdownTime) // only allow shutdown exit if time > 0
|
|
|
|
|
if (lastMovementTime)
|
|
|
|
|
if (((uint32_t)(HAL_GetTick() - lastMovementTime)) >
|
|
|
|
|
(uint32_t)(systemSettings.ShutdownTime * 60 * 1000)) {
|
|
|
|
|
if (((uint32_t) (HAL_GetTick() - lastMovementTime))
|
|
|
|
|
> (uint32_t) (systemSettings.ShutdownTime * 60 * 1000)) {
|
|
|
|
|
// shutdown
|
|
|
|
|
currentlyActiveTemperatureTarget = 0;
|
|
|
|
|
return 1; // we want to exit soldering mode
|
|
|
|
|
@@ -489,6 +511,7 @@ static int gui_SolderingSleepingMode() {
|
|
|
|
|
lcd.refresh();
|
|
|
|
|
GUIDelay();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
static void gui_solderingMode() {
|
|
|
|
|
/*
|
|
|
|
|
@@ -528,7 +551,8 @@ static void gui_solderingMode() {
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_F_LONG:
|
|
|
|
|
// if boost mode is enabled turn it on
|
|
|
|
|
if (systemSettings.boostModeEnabled) boostModeOn = true;
|
|
|
|
|
if (systemSettings.boostModeEnabled)
|
|
|
|
|
boostModeOn = true;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_F_SHORT:
|
|
|
|
|
case BUTTON_B_SHORT: {
|
|
|
|
|
@@ -537,7 +561,8 @@ static void gui_solderingMode() {
|
|
|
|
|
if (oldTemp != systemSettings.SolderingTemp) {
|
|
|
|
|
saveSettings(); // only save on change
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -608,19 +633,19 @@ static void gui_solderingMode() {
|
|
|
|
|
// Update the setpoints for the temperature
|
|
|
|
|
if (boostModeOn) {
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
currentlyActiveTemperatureTarget =
|
|
|
|
|
ftoTipMeasurement(systemSettings.BoostTemp);
|
|
|
|
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
|
|
|
|
systemSettings.BoostTemp);
|
|
|
|
|
else
|
|
|
|
|
currentlyActiveTemperatureTarget =
|
|
|
|
|
ctoTipMeasurement(systemSettings.BoostTemp);
|
|
|
|
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
|
|
|
|
systemSettings.BoostTemp);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
currentlyActiveTemperatureTarget =
|
|
|
|
|
ftoTipMeasurement(systemSettings.SolderingTemp);
|
|
|
|
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
|
|
|
|
systemSettings.SolderingTemp);
|
|
|
|
|
else
|
|
|
|
|
currentlyActiveTemperatureTarget =
|
|
|
|
|
ctoTipMeasurement(systemSettings.SolderingTemp);
|
|
|
|
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
|
|
|
|
systemSettings.SolderingTemp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Undervoltage test
|
|
|
|
|
@@ -630,8 +655,8 @@ static void gui_solderingMode() {
|
|
|
|
|
|
|
|
|
|
lcd.refresh();
|
|
|
|
|
if (systemSettings.sensitivity)
|
|
|
|
|
if (HAL_GetTick() - lastMovementTime > sleepThres &&
|
|
|
|
|
HAL_GetTick() - lastButtonTime > sleepThres) {
|
|
|
|
|
if (HAL_GetTick() - lastMovementTime > sleepThres
|
|
|
|
|
&& HAL_GetTick() - lastButtonTime > sleepThres) {
|
|
|
|
|
if (gui_SolderingSleepingMode()) {
|
|
|
|
|
return; // If the function returns non-0 then exit
|
|
|
|
|
}
|
|
|
|
|
@@ -667,11 +692,13 @@ void startGUITask(void const *argument) {
|
|
|
|
|
uint8_t tempWarningState = 0;
|
|
|
|
|
|
|
|
|
|
HAL_IWDG_Refresh(&hiwdg);
|
|
|
|
|
if (showBootLogoIfavailable()) waitForButtonPressOrTimeout(2000);
|
|
|
|
|
if (showBootLogoIfavailable())
|
|
|
|
|
waitForButtonPressOrTimeout(2000);
|
|
|
|
|
HAL_IWDG_Refresh(&hiwdg);
|
|
|
|
|
if (systemSettings.autoStartMode) {
|
|
|
|
|
// jump directly to the autostart mode
|
|
|
|
|
if (systemSettings.autoStartMode == 1) gui_solderingMode();
|
|
|
|
|
if (systemSettings.autoStartMode == 1)
|
|
|
|
|
gui_solderingMode();
|
|
|
|
|
}
|
|
|
|
|
#if ACCELDEBUG
|
|
|
|
|
|
|
|
|
|
@@ -684,7 +711,8 @@ void startGUITask(void const *argument) {
|
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
if (tempWarningState == 2) buttons = BUTTON_F_SHORT;
|
|
|
|
|
if (tempWarningState == 2)
|
|
|
|
|
buttons = BUTTON_F_SHORT;
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_NONE:
|
|
|
|
|
// Do nothing
|
|
|
|
|
@@ -699,7 +727,7 @@ void startGUITask(void const *argument) {
|
|
|
|
|
lcd.clearScreen(); // Ensure the buffer starts clean
|
|
|
|
|
lcd.setCursor(0, 0); // Position the cursor at the 0,0 (top left)
|
|
|
|
|
lcd.setFont(1); // small font
|
|
|
|
|
lcd.print((char *)"V2.01"); // Print version number
|
|
|
|
|
lcd.print((char *) "V2.03"); // Print version number
|
|
|
|
|
lcd.setCursor(0, 8); // second line
|
|
|
|
|
lcd.print(__DATE__); // print the compile date
|
|
|
|
|
lcd.refresh();
|
|
|
|
|
@@ -722,8 +750,7 @@ void startGUITask(void const *argument) {
|
|
|
|
|
lcd.displayOnOff(true); // turn lcd on
|
|
|
|
|
gui_settingsMenu(); // enter the settings menu
|
|
|
|
|
saveSettings();
|
|
|
|
|
setCalibrationOffset(
|
|
|
|
|
systemSettings.CalibrationOffset); // ensure cal offset is applied
|
|
|
|
|
setCalibrationOffset(systemSettings.CalibrationOffset); // ensure cal offset is applied
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
@@ -731,17 +758,17 @@ void startGUITask(void const *argument) {
|
|
|
|
|
currentlyActiveTemperatureTarget = 0; // ensure tip is off
|
|
|
|
|
|
|
|
|
|
if (systemSettings.sensitivity) {
|
|
|
|
|
if ((HAL_GetTick() - lastMovementTime) > 60000 &&
|
|
|
|
|
(HAL_GetTick() - lastButtonTime) > 60000)
|
|
|
|
|
if ((HAL_GetTick() - lastMovementTime) > 60000
|
|
|
|
|
&& (HAL_GetTick() - lastButtonTime) > 60000)
|
|
|
|
|
lcd.displayOnOff(false); // turn lcd off when no movement
|
|
|
|
|
else if (HAL_GetTick() - lastMovementTime < 1000 ||
|
|
|
|
|
HAL_GetTick() - lastButtonTime <
|
|
|
|
|
1000) /*Use short time for test, and prevent lots of I2C
|
|
|
|
|
else if (HAL_GetTick() - lastMovementTime < 1000
|
|
|
|
|
|| HAL_GetTick() - lastButtonTime < 1000) /*Use short time for test, and prevent lots of I2C
|
|
|
|
|
writes for no need*/
|
|
|
|
|
lcd.displayOnOff(true); // turn lcd back on
|
|
|
|
|
}
|
|
|
|
|
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
|
|
|
|
|
if (tipTemp > 600) tipTemp = 0;
|
|
|
|
|
if (tipTemp > 600)
|
|
|
|
|
tipTemp = 0;
|
|
|
|
|
if (tipTemp > 50) {
|
|
|
|
|
if (tempWarningState == 0) {
|
|
|
|
|
currentlyActiveTemperatureTarget = 0; // ensure tip is off
|
|
|
|
|
@@ -771,9 +798,11 @@ void startGUITask(void const *argument) {
|
|
|
|
|
}
|
|
|
|
|
lcd.setCursor(0, 8);
|
|
|
|
|
lcd.print(InputVoltageString);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
|
|
|
|
2);
|
|
|
|
|
lcd.drawChar('.');
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
|
|
|
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
|
|
|
|
1);
|
|
|
|
|
lcd.print("V");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -839,9 +868,12 @@ void startPIDTask(void const *argument) {
|
|
|
|
|
|
|
|
|
|
/*Compute PID Output*/
|
|
|
|
|
int32_t output = (rawTempError / kp);
|
|
|
|
|
if (ki) output += integralCount;
|
|
|
|
|
if (kd) output -= (dInput / kd);
|
|
|
|
|
if (kb) output -= backoffOverflow / kb;
|
|
|
|
|
if (ki)
|
|
|
|
|
output += integralCount;
|
|
|
|
|
if (kd)
|
|
|
|
|
output -= (dInput / kd);
|
|
|
|
|
if (kb)
|
|
|
|
|
output -= backoffOverflow / kb;
|
|
|
|
|
|
|
|
|
|
if (output > 100) {
|
|
|
|
|
backoffOverflow = output;
|
|
|
|
|
@@ -882,7 +914,8 @@ void startMOVTask(void const *argument) {
|
|
|
|
|
memset(dataz, 0, MOVFilter * sizeof(int16_t));
|
|
|
|
|
int16_t tx, ty, tz;
|
|
|
|
|
int32_t avgx, avgy, avgz;
|
|
|
|
|
if (systemSettings.sensitivity > 9) systemSettings.sensitivity = 9;
|
|
|
|
|
if (systemSettings.sensitivity > 9)
|
|
|
|
|
systemSettings.sensitivity = 9;
|
|
|
|
|
#if ACCELDEBUG
|
|
|
|
|
uint32_t max = 0;
|
|
|
|
|
#endif
|
|
|
|
|
@@ -892,9 +925,9 @@ void startMOVTask(void const *argument) {
|
|
|
|
|
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
|
|
|
|
|
accel.getAxisReadings(&tx, &ty, &tz);
|
|
|
|
|
|
|
|
|
|
datax[currentPointer] = (int32_t)tx;
|
|
|
|
|
datay[currentPointer] = (int32_t)ty;
|
|
|
|
|
dataz[currentPointer] = (int32_t)tz;
|
|
|
|
|
datax[currentPointer] = (int32_t) tx;
|
|
|
|
|
datay[currentPointer] = (int32_t) ty;
|
|
|
|
|
dataz[currentPointer] = (int32_t) tz;
|
|
|
|
|
currentPointer = (currentPointer + 1) % MOVFilter;
|
|
|
|
|
#if ACCELDEBUG
|
|
|
|
|
// Debug for Accel
|
|
|
|
|
@@ -976,9 +1009,9 @@ void startRotationTask(void const *argument) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (;;) {
|
|
|
|
|
if (xSemaphoreTake(rotationChangedSemaphore, portMAX_DELAY) == pdTRUE ||
|
|
|
|
|
(HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port, INT_Orientation_Pin) ==
|
|
|
|
|
GPIO_PIN_RESET)) {
|
|
|
|
|
if (xSemaphoreTake(rotationChangedSemaphore, portMAX_DELAY) == pdTRUE
|
|
|
|
|
|| (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port,
|
|
|
|
|
INT_Orientation_Pin) == GPIO_PIN_RESET)) {
|
|
|
|
|
// a rotation event has occured
|
|
|
|
|
bool rotation = accel.getOrientation();
|
|
|
|
|
if (systemSettings.OrientationMode == 2)
|
|
|
|
|
@@ -992,7 +1025,8 @@ void startRotationTask(void const *argument) {
|
|
|
|
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
|
|
|
|
static signed long xHigherPriorityTaskWoken;
|
|
|
|
|
if (GPIO_Pin == INT_Orientation_Pin) {
|
|
|
|
|
xSemaphoreGiveFromISR(rotationChangedSemaphore, &xHigherPriorityTaskWoken);
|
|
|
|
|
xSemaphoreGiveFromISR(rotationChangedSemaphore,
|
|
|
|
|
&xHigherPriorityTaskWoken);
|
|
|
|
|
} else if (GPIO_Pin == INT_Movement_Pin) {
|
|
|
|
|
// New data is available for reading from the unit
|
|
|
|
|
// xSemaphoreGiveFromISR(accelDataAvailableSemaphore,
|
|
|
|
|
@@ -1009,7 +1043,7 @@ bool showBootLogoIfavailable() {
|
|
|
|
|
uint16_t temp[98];
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < (98); i++) {
|
|
|
|
|
temp[i] = *(uint16_t *)(FLASH_LOGOADDR + (i * 2));
|
|
|
|
|
temp[i] = *(uint16_t *) (FLASH_LOGOADDR + (i * 2));
|
|
|
|
|
}
|
|
|
|
|
uint8_t temp8[98 * 2];
|
|
|
|
|
for (uint8_t i = 0; i < 98; i++) {
|
|
|
|
|
@@ -1017,12 +1051,16 @@ bool showBootLogoIfavailable() {
|
|
|
|
|
temp8[i * 2 + 1] = temp[i] & 0xFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (temp8[0] != 0xAA) return false;
|
|
|
|
|
if (temp8[1] != 0x55) return false;
|
|
|
|
|
if (temp8[2] != 0xF0) return false;
|
|
|
|
|
if (temp8[3] != 0x0D) return false;
|
|
|
|
|
if (temp8[0] != 0xAA)
|
|
|
|
|
return false;
|
|
|
|
|
if (temp8[1] != 0x55)
|
|
|
|
|
return false;
|
|
|
|
|
if (temp8[2] != 0xF0)
|
|
|
|
|
return false;
|
|
|
|
|
if (temp8[3] != 0x0D)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
lcd.drawArea(0, 0, 96, 16, (uint8_t *)(temp8 + 4));
|
|
|
|
|
lcd.drawArea(0, 0, 96, 16, (uint8_t *) (temp8 + 4));
|
|
|
|
|
lcd.refresh();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|