Formatting the C/C++ files
This commit is contained in:
@@ -9,30 +9,30 @@
|
||||
*/
|
||||
|
||||
#include "Settings.h"
|
||||
#include "Setup.h"
|
||||
#include "../../configuration.h"
|
||||
#include "BSP.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "string.h"
|
||||
volatile systemSettingsType systemSettings;
|
||||
|
||||
void saveSettings() {
|
||||
// First we erase the flash
|
||||
flash_save_buffer((uint8_t*) &systemSettings, sizeof(systemSettingsType));
|
||||
// First we erase the flash
|
||||
flash_save_buffer((uint8_t *)&systemSettings, sizeof(systemSettingsType));
|
||||
}
|
||||
|
||||
bool restoreSettings() {
|
||||
// We read the flash
|
||||
flash_read_buffer((uint8_t*) &systemSettings, sizeof(systemSettingsType));
|
||||
// We read the flash
|
||||
flash_read_buffer((uint8_t *)&systemSettings, sizeof(systemSettingsType));
|
||||
|
||||
// if the version is correct were done
|
||||
// if not we reset and save
|
||||
if (systemSettings.version != SETTINGSVERSION) {
|
||||
// probably not setup
|
||||
resetSettings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// if the version is correct were done
|
||||
// if not we reset and save
|
||||
if (systemSettings.version != SETTINGSVERSION) {
|
||||
// probably not setup
|
||||
resetSettings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Lookup function for cutoff setting -> X10 voltage
|
||||
/*
|
||||
@@ -43,59 +43,59 @@ bool restoreSettings() {
|
||||
* 4=6S
|
||||
*/
|
||||
uint8_t lookupVoltageLevel() {
|
||||
if (systemSettings.minDCVoltageCells == 0)
|
||||
return 90; // 9V since iron does not function effectively below this
|
||||
else
|
||||
return (systemSettings.minDCVoltageCells * 33) + (33 * 2);
|
||||
if (systemSettings.minDCVoltageCells == 0)
|
||||
return 90; // 9V since iron does not function effectively below this
|
||||
else
|
||||
return (systemSettings.minDCVoltageCells * 33) + (33 * 2);
|
||||
}
|
||||
void resetSettings() {
|
||||
memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
|
||||
systemSettings.SleepTemp = SLEEP_TEMP; // Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = SLEEP_TIME; // How many seconds/minutes we wait until going
|
||||
// to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = SOLDERING_TEMP; // Default soldering temp is 320.0 C
|
||||
systemSettings.minDCVoltageCells = CUT_OUT_SETTING; // default to no cut-off voltage
|
||||
systemSettings.QCIdealVoltage = 0; // Default to 9V for QC3.0 Voltage
|
||||
systemSettings.version = SETTINGSVERSION; // Store the version number to allow for easier upgrades
|
||||
systemSettings.detailedSoldering = DETAILED_SOLDERING; // Detailed soldering screen
|
||||
systemSettings.detailedIDLE = DETAILED_IDLE; // Detailed idle screen (off for first time users)
|
||||
systemSettings.OrientationMode = ORIENTATION_MODE; // Default to automatic
|
||||
systemSettings.sensitivity = SENSITIVITY; // Default high sensitivity
|
||||
systemSettings.voltageDiv = VOLTAGE_DIV; // Default divider from schematic
|
||||
systemSettings.ShutdownTime = SHUTDOWN_TIME; // How many minutes until the unit turns itself off
|
||||
systemSettings.BoostTemp = BOOST_TEMP; // default to 400C
|
||||
systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety
|
||||
systemSettings.lockingMode = LOCKING_MODE; // Disable locking for safety
|
||||
systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C
|
||||
memset((void *)&systemSettings, 0, sizeof(systemSettingsType));
|
||||
systemSettings.SleepTemp = SLEEP_TEMP; // Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = SLEEP_TIME; // How many seconds/minutes we wait until going
|
||||
// to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = SOLDERING_TEMP; // Default soldering temp is 320.0 C
|
||||
systemSettings.minDCVoltageCells = CUT_OUT_SETTING; // default to no cut-off voltage
|
||||
systemSettings.QCIdealVoltage = 0; // Default to 9V for QC3.0 Voltage
|
||||
systemSettings.version = SETTINGSVERSION; // Store the version number to allow for easier upgrades
|
||||
systemSettings.detailedSoldering = DETAILED_SOLDERING; // Detailed soldering screen
|
||||
systemSettings.detailedIDLE = DETAILED_IDLE; // Detailed idle screen (off for first time users)
|
||||
systemSettings.OrientationMode = ORIENTATION_MODE; // Default to automatic
|
||||
systemSettings.sensitivity = SENSITIVITY; // Default high sensitivity
|
||||
systemSettings.voltageDiv = VOLTAGE_DIV; // Default divider from schematic
|
||||
systemSettings.ShutdownTime = SHUTDOWN_TIME; // How many minutes until the unit turns itself off
|
||||
systemSettings.BoostTemp = BOOST_TEMP; // default to 400C
|
||||
systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety
|
||||
systemSettings.lockingMode = LOCKING_MODE; // Disable locking for safety
|
||||
systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
||||
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
||||
#endif
|
||||
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
|
||||
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
|
||||
systemSettings.powerLimit = POWER_LIMIT; // 30 watts default limit
|
||||
systemSettings.ReverseButtonTempChangeEnabled = REVERSE_BUTTON_TEMP_CHANGE; //
|
||||
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; //
|
||||
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; //
|
||||
systemSettings.KeepAwakePulse = POWER_PULSE_DEFAULT;
|
||||
systemSettings.hallEffectSensitivity = 1;
|
||||
systemSettings.accelMissingWarningCounter = 0;
|
||||
systemSettings.pdMissingWarningCounter = 0;
|
||||
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
|
||||
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
|
||||
systemSettings.powerLimit = POWER_LIMIT; // 30 watts default limit
|
||||
systemSettings.ReverseButtonTempChangeEnabled = REVERSE_BUTTON_TEMP_CHANGE; //
|
||||
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; //
|
||||
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; //
|
||||
systemSettings.KeepAwakePulse = POWER_PULSE_DEFAULT;
|
||||
systemSettings.hallEffectSensitivity = 1;
|
||||
systemSettings.accelMissingWarningCounter = 0;
|
||||
systemSettings.pdMissingWarningCounter = 0;
|
||||
|
||||
saveSettings(); // Save defaults
|
||||
saveSettings(); // Save defaults
|
||||
}
|
||||
|
||||
uint16_t lookupHallEffectThreshold() {
|
||||
// Return the threshold above which the hall effect sensor is "activated"
|
||||
switch (systemSettings.hallEffectSensitivity) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1: //Low
|
||||
return 1000;
|
||||
case 2: //Medium
|
||||
return 500;
|
||||
case 3: //High
|
||||
return 100;
|
||||
default:
|
||||
return 0; //Off
|
||||
}
|
||||
// Return the threshold above which the hall effect sensor is "activated"
|
||||
switch (systemSettings.hallEffectSensitivity) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1: // Low
|
||||
return 1000;
|
||||
case 2: // Medium
|
||||
return 500;
|
||||
case 3: // High
|
||||
return 100;
|
||||
default:
|
||||
return 0; // Off
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user