mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Updating cutoff voltage to DC/3.5V*cell count
Working on progress for: #29 #30
This commit is contained in:
@@ -34,14 +34,12 @@ void setup() {
|
||||
I2C_Configuration(); //Start the I2C hardware
|
||||
GPIO_Init_OLED(); //Init the GPIO ports for the OLED
|
||||
restoreSettings(); //Load settings
|
||||
|
||||
StartUp_Accelerometer(systemSettings.sensitivity); //start the accelerometer
|
||||
|
||||
StartUp_Accelerometer(systemSettings.sensitivity); //Start the accelerometer
|
||||
setupPID(); //Init the PID values
|
||||
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
|
||||
Init_Oled(systemSettings.flipDisplay); //Init the OLED display
|
||||
|
||||
OLED_DrawString("VER 1.13", 8); //Version Number
|
||||
OLED_DrawString("VER 1.14", 8); //Version Number
|
||||
delayMs(500); //Pause to show version number
|
||||
Start_Watchdog(1000); //start the system watch dog as 1 second timeout
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* Author: Ralim <ralim@ralimtek.com>
|
||||
*/
|
||||
#include "Modes.h"
|
||||
const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
||||
const char *SettingsLongNames[] = {
|
||||
" Power source. Sets cutoff voltage. <DC 10V> <S 3.5V per cell>",
|
||||
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
||||
" Shutdown Timeout <Minutes>",
|
||||
" Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
|
||||
@@ -14,8 +15,6 @@ const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
||||
" Flip Display for Left Hand",
|
||||
" Enable front key boost 450C mode when soldering",
|
||||
" Temperature when in boost mode" };
|
||||
const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 67, 22, 33, 37, 32,
|
||||
53, 36 };
|
||||
uint8_t StatusFlags = 0;
|
||||
uint32_t temporaryTempStorage = 0;
|
||||
//This does the required processing and state changes
|
||||
@@ -95,7 +94,7 @@ void ProcessUI() {
|
||||
}
|
||||
}
|
||||
uint16_t voltage = readDCVoltage(systemSettings.voltageDiv); //get X10 voltage
|
||||
if ((voltage / 10) < systemSettings.cutoutVoltage) {
|
||||
if ((voltage) < lookupVoltageLevel(systemSettings.cutoutSetting)) {
|
||||
operatingMode = UVLOWARN;
|
||||
lastModeChange = millis();
|
||||
}
|
||||
@@ -147,9 +146,8 @@ void ProcessUI() {
|
||||
switch (settingsPage) {
|
||||
case UVCO:
|
||||
//we are incrementing the cutout voltage
|
||||
systemSettings.cutoutVoltage += 1; //Go up 1V at a jump
|
||||
if (systemSettings.cutoutVoltage > 24)
|
||||
systemSettings.cutoutVoltage = 10;
|
||||
systemSettings.cutoutSetting += 1; //Go up 1V at a jump
|
||||
systemSettings.cutoutSetting %= 5; //wrap 0->4
|
||||
break;
|
||||
case SLEEP_TEMP:
|
||||
systemSettings.SleepTemp += 100; //Go up 10C at a time
|
||||
@@ -455,7 +453,7 @@ void DrawUI() {
|
||||
StatusFlags = 4;
|
||||
//If the user has idled for > 3 seconds, show the long name for the selected setting instead
|
||||
//draw from settingsLongTestScrollPos through to end of screen
|
||||
uint8_t lengthLeft = SettingsLongNamesLengths[settingsPage]
|
||||
uint8_t lengthLeft = strlen(SettingsLongNames[settingsPage])
|
||||
- settingsLongTestScrollPos;
|
||||
if (lengthLeft < 1)
|
||||
settingsLongTestScrollPos = 0;
|
||||
@@ -476,9 +474,16 @@ void DrawUI() {
|
||||
settingsLongTestScrollPos = 0;
|
||||
switch (settingsPage) {
|
||||
case UVCO:
|
||||
OLED_DrawString("UVCO ", 5);
|
||||
OLED_DrawTwoNumber(systemSettings.cutoutVoltage, 5);
|
||||
OLED_DrawChar('V', 7);
|
||||
OLED_DrawString("PWRSC ", 6);
|
||||
if (systemSettings.cutoutSetting == 0) {
|
||||
//DC
|
||||
OLED_DrawChar('D', 6);
|
||||
OLED_DrawChar('C', 7);
|
||||
} else {
|
||||
//S count
|
||||
OLED_DrawChar('2' + systemSettings.cutoutSetting, 6);
|
||||
OLED_DrawChar('S', 7);
|
||||
}
|
||||
break;
|
||||
case SLEEP_TEMP:
|
||||
OLED_DrawString("STMP ", 5);
|
||||
|
||||
@@ -38,23 +38,36 @@ void restoreSettings() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Lookup function for cutoff setting -> X10 voltage
|
||||
/*
|
||||
* 0=DC
|
||||
* 1=3S
|
||||
* 2=4S
|
||||
* 3=5S
|
||||
* 4=6S
|
||||
*/
|
||||
uint8_t lookupVoltageLevel(uint8_t level) {
|
||||
if (level == 0)
|
||||
return 100; //10V since iron does not function below this
|
||||
else
|
||||
return (level * 35) + (35 * 2);
|
||||
}
|
||||
void resetSettings() {
|
||||
|
||||
systemSettings.SleepTemp = 1500; //Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = 1; //How many minutes we wait until going to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = 3200; //Default soldering temp is 320.0 C
|
||||
systemSettings.cutoutVoltage = 10; //10V is the minium cutout voltage as the unit V measurement is unstable below 9.5V
|
||||
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
||||
systemSettings.displayTempInF =0; //default to C
|
||||
systemSettings.flipDisplay=0; //Default to right handed mode
|
||||
systemSettings.sensitivity=6; //Default high sensitivity
|
||||
systemSettings.tempCalibration=239; //Default to their calibration value
|
||||
systemSettings.voltageDiv=144; //Default divider from schematic
|
||||
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off
|
||||
systemSettings.displayUpdateSpeed=1; //How fast the LCD updates
|
||||
systemSettings.temperatureRounding=0; //How the temperature is rounded off
|
||||
systemSettings.boostModeEnabled=0; //Default to safe, with no boost mode
|
||||
systemSettings.BoostTemp=4000; //default to 400C
|
||||
systemSettings.SleepTemp = 1500;//Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = 1;//How many minutes we wait until going to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = 3200; //Default soldering temp is 320.0 C
|
||||
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
||||
systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
|
||||
systemSettings.displayTempInF = 0; //default to C
|
||||
systemSettings.flipDisplay = 0; //Default to right handed mode
|
||||
systemSettings.sensitivity = 6; //Default high sensitivity
|
||||
systemSettings.tempCalibration = 239; //Default to their calibration value
|
||||
systemSettings.voltageDiv = 144; //Default divider from schematic
|
||||
systemSettings.ShutdownTime = 30;//How many minutes until the unit turns itself off
|
||||
systemSettings.displayUpdateSpeed = 1; //How fast the LCD updates
|
||||
systemSettings.temperatureRounding = 0; //How the temperature is rounded off
|
||||
systemSettings.boostModeEnabled = 0;//Default to safe, with no boost mode
|
||||
systemSettings.BoostTemp = 4000; //default to 400C
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user