Compare commits

...

2 Commits

Author SHA1 Message Date
Ben V. Brown
7b4f467eec Increase pre PID filtering, reducing display flicker
Also improve movement sensitivities to be less extreme ramp up
2017-07-07 23:22:20 +10:00
Ben V. Brown
f72fc36427 Update README.md 2017-07-07 22:23:05 +10:00
7 changed files with 58 additions and 25 deletions

View File

@@ -48,6 +48,7 @@ Pressing both buttons will also exit the soldering mode.
This menu allows you to cycle through all the options and set their values. This menu allows you to cycle through all the options and set their values.
The button near the tip cycles through the options, and the one near the usb changes the selected option. The button near the tip cycles through the options, and the one near the usb changes the selected option.
Note that settings are not saved until you exit the menu, and some settings such as screen flip do not apply until a power cycle is applied. Note that settings are not saved until you exit the menu, and some settings such as screen flip do not apply until a power cycle is applied.
If you leave the unit alone (ie don't press any buttons) on a setting, after 3 seconds the screen will scroll a longer version of the name
* UVCO -> Undervoltage cut out level, settable in 1V increments from 10-24V * UVCO -> Undervoltage cut out level, settable in 1V increments from 10-24V
* STMP -> The temperature the unit drops to in sleep mode * STMP -> The temperature the unit drops to in sleep mode
@@ -56,9 +57,11 @@ Note that settings are not saved until you exit the menu, and some settings such
* MOTION -> Wether motion detection is enabled or not * MOTION -> Wether motion detection is enabled or not
* SENSE -> Motion Sensitivity, H is more sensitive. L is lowest sensitivity (ie takes more movement to trigger) * SENSE -> Motion Sensitivity, H is more sensitive. L is lowest sensitivity (ie takes more movement to trigger)
* TMPUNIT -> Temperature unit, C or F * TMPUNIT -> Temperature unit, C or F
* DISPMD -> Display mode : {Fast,Slow,Rounded,None} * TMPRND -> Temperature Rounding, {1,5,10}
* TMPSPD -> How fast the temperature should update in the soldering status screen.
* FLPDSP -> Flip display for left handed users * FLPDSP -> Flip display for left handed users
Temperature rounding means that the unit will round off the temperature before displaying. This can helpt to reduce the flickering of the temperature when the unit oscillates between two temperatures.
## Extras Menu ## Extras Menu
This menu defaults to showing the current temperature on the tip. This menu defaults to showing the current temperature on the tip.
Pressing the button near the iron tip will show the current input voltage. Pressing the other button while this is show will allow you to calibrate the reading if your iron is like mine and is not overly accurate out of the factory. (Press buttons to change measurement up and down, press both to exit and save). Pressing the button near the iron tip will show the current input voltage. Pressing the other button while this is show will allow you to calibrate the reading if your iron is like mine and is not overly accurate out of the factory. (Press buttons to change measurement up and down, press both to exit and save).
@@ -66,6 +69,9 @@ Pressing the button near the iron tip will show the current input voltage. Press
Pressing the button near the usb enters the temperature offset setting menu, when the iron is cold, pressing the other button will start the unit calibrating for any offset in the tip temperature. Pressing the button near the usb enters the temperature offset setting menu, when the iron is cold, pressing the other button will start the unit calibrating for any offset in the tip temperature.
# Version Changes: # Version Changes:
V1.10
-Adds help text to settings
- Improves settings for the display update rate
V1.09 V1.09
- Adds display modes, for slowing down or simplifying the display - Adds display modes, for slowing down or simplifying the display

View File

@@ -14,8 +14,8 @@
#define SETTINGSVERSION 0x08 /*Change this if you change the struct below to prevent people getting out of sync*/ #define SETTINGSVERSION 0x08 /*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 (0x10) #define MOTION_MED (0x01)
#define MOTION_LOW (0x20) #define MOTION_LOW (0x02)
//Display Speeds //Display Speeds
#define DISPLAYMODE_FAST (0x00) #define DISPLAYMODE_FAST (0x00)
#define DISPLAYMODE_MEDIUM (0x01) #define DISPLAYMODE_MEDIUM (0x01)

View File

@@ -23,7 +23,7 @@ uint16_t readDCVoltage(uint16_t divFactor) {
//This allows us to read it in X10 mode //This allows us to read it in X10 mode
//Returns temperature in C X10 mode //Returns temperature in C X10 mode
int16_t readTipTemp() { int16_t readTipTemp() {
static uint32_t rollingAverage[4]; static uint32_t rollingAverage[16];
static uint8_t rIndex = 0; static uint8_t rIndex = 0;
/*The head has a thermocouple inline with the heater /*The head has a thermocouple inline with the heater
@@ -54,9 +54,13 @@ int16_t readTipTemp() {
ad_sum = ad_sum - max - min; //remove the two outliers ad_sum = ad_sum - max - min; //remove the two outliers
avg_data = ad_sum / 8; //take the average avg_data = ad_sum / 8; //take the average
rollingAverage[rIndex] = avg_data; rollingAverage[rIndex] = avg_data;
rIndex = (rIndex + 1) % 4; rIndex = (rIndex + 1) % 16;
return (rollingAverage[0] + rollingAverage[1] + rollingAverage[2] return (rollingAverage[0] + rollingAverage[1] + rollingAverage[2]
+ rollingAverage[3]) / 4; //get the average + rollingAverage[3] + rollingAverage[4] + rollingAverage[5]
+ rollingAverage[6] + rollingAverage[7] + rollingAverage[8]
+ rollingAverage[9] + rollingAverage[10] + rollingAverage[11]
+ rollingAverage[12] + rollingAverage[13] + rollingAverage[14]
+ rollingAverage[15]) / 16; //get the average
} }
@@ -110,7 +114,7 @@ uint16_t readIronTemp(uint16_t calibration_temp, uint8_t read,
static uint16_t calTemp = 0; static uint16_t calTemp = 0;
static uint16_t lastVal = 0; static uint16_t lastVal = 0;
static uint16_t lastSetTemp; static uint16_t lastSetTemp;
if(setPointTemp!=0xFFFF) if (setPointTemp != 0xFFFF)
lastSetTemp = setPointTemp; lastSetTemp = setPointTemp;
if (calibration_temp != 0) if (calibration_temp != 0)
calTemp = calibration_temp; calTemp = calibration_temp;

View File

@@ -34,7 +34,20 @@ 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
I2C_RegisterWrite(FF_MT_THS_REG, sensitivity|0x0F); // Set threshold uint8_t sens =0x0F;
switch(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_COUNT_REG, 0x01); // Set debounce to 100ms I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
I2C_RegisterWrite( CTRL_REG4, 0x04); // Enable motion interrupt I2C_RegisterWrite( CTRL_REG4, 0x04); // Enable motion interrupt

View File

@@ -38,6 +38,6 @@ void setup() {
Init_Oled(systemSettings.flipDisplay); //Init the OLED display Init_Oled(systemSettings.flipDisplay); //Init the OLED display
OLED_DrawString("VER 1.10", 8); //Version Number OLED_DrawString("VER 1.10", 8); //Version Number
delayMs(800); //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

@@ -5,14 +5,14 @@
* Author: Ralim <ralim@ralimtek.com> * Author: Ralim <ralim@ralimtek.com>
*/ */
#include "Modes.h" #include "Modes.h"
const char *SettingsLongNames[] = { " Undervoltage Cutout", const char *SettingsLongNames[] = { " Undervoltage Cutout (V)",
" Sleep Temperature", " Sleep Timeout", " Sleep Temperature (C)", " Sleep Timeout (Minutes)",
" Shutdown Timeout", " Motion Detection", " Shutdown Timeout (Minutes)", " Motion Detection",
" Motion Sensitivity", " Temperature Unit", " Motion Sensitivity", " Temperature Unit",
" Temperature Rounding Amount", " Temperature Rounding Amount",
" Temperature Display Update Rate", " Temperature Display Update Rate",
" Flip Display for Left Hand" }; " Flip Display for Left Hand" };
const uint8_t SettingsLongNamesLengths[] = { 25, 23, 19, 22, 22, 24, 22, 33, 37, const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 22, 24, 22, 33, 37,
25 }; 25 };
uint8_t CalStatus = 0; uint8_t CalStatus = 0;
//This does the required processing and state changes //This does the required processing and state changes
@@ -141,9 +141,8 @@ void ProcessUI() {
systemSettings.flipDisplay = !systemSettings.flipDisplay; systemSettings.flipDisplay = !systemSettings.flipDisplay;
break; break;
case MOTIONSENSITIVITY: case MOTIONSENSITIVITY:
systemSettings.sensitivity += 0x10; systemSettings.sensitivity++;
if (systemSettings.sensitivity > 0x20) systemSettings.sensitivity = systemSettings.sensitivity % 3;
systemSettings.sensitivity = 0; //reset to high on wrap
break; break;
case TEMPROUNDING: case TEMPROUNDING:
@@ -320,6 +319,9 @@ void drawTemp(uint16_t temp, uint8_t x, uint8_t roundingMode) {
*/ */
void DrawUI() { void DrawUI() {
static uint32_t lastOLEDDrawTime = 0; static uint32_t lastOLEDDrawTime = 0;
static uint16_t lastSolderingDrawnTemp1 = 0;
static uint16_t lastSolderingDrawnTemp2 = 0;
static uint8_t settingsLongTestScrollPos = 0; static uint8_t settingsLongTestScrollPos = 0;
uint16_t temp = readIronTemp(0, 0, 0xFFFF); uint16_t temp = readIronTemp(0, 0, 0xFFFF);
switch (operatingMode) { switch (operatingMode) {
@@ -348,17 +350,24 @@ void DrawUI() {
&& (millis() - lastOLEDDrawTime < 50)) && (millis() - lastOLEDDrawTime < 50))
return; return;
drawTemp(temp, 0, systemSettings.temperatureRounding); uint32_t tempavg = (temp + lastSolderingDrawnTemp1
+ lastSolderingDrawnTemp2);
tempavg /= 3;
drawTemp(tempavg, 0, systemSettings.temperatureRounding);
lastSolderingDrawnTemp1 = temp;
lastSolderingDrawnTemp2 = lastSolderingDrawnTemp1;
lastOLEDDrawTime = millis(); lastOLEDDrawTime = millis();
//Now draw symbols //Now draw symbols
OLED_DrawChar(' ', 3); OLED_DrawChar(' ', 3);
OLED_BlankSlot(6 * 12 + 16, 24 - 16);//blank out the tail after the arrows OLED_BlankSlot(6 * 12 + 16, 24 - 16);//blank out the tail after the arrows
OLED_BlankSlot(4 * 12 + 16, 24 - 16);//blank out the tail after the temp OLED_BlankSlot(4 * 12 + 16, 24 - 16);//blank out the tail after the temp
if (getIronTimer() == 0) { if (getIronTimer() == 0
&& (temp / 10) > (systemSettings.SolderingTemp / 10)) {
//Cooling
OLED_DrawSymbol(6, 5); OLED_DrawSymbol(6, 5);
} else { } else {
if (getIronTimer() < 1000) { if (getIronTimer() < 1500) {
//Maintaining
OLED_DrawSymbol(6, 7); OLED_DrawSymbol(6, 7);
} else { //we are heating } else { //we are heating
OLED_DrawSymbol(6, 6); OLED_DrawSymbol(6, 6);
@@ -507,6 +516,7 @@ void DrawUI() {
//Draw in temp and sleep //Draw in temp and sleep
OLED_DrawString("SLP", 3); OLED_DrawString("SLP", 3);
drawTemp(temp, 4, systemSettings.temperatureRounding); drawTemp(temp, 4, systemSettings.temperatureRounding);
OLED_BlankSlot(84, 96 - 85); //blank out after the temp
if (millis() - getLastMovement() > (10 * 60 * 1000) if (millis() - getLastMovement() > (10 * 60 * 1000)
&& (millis() - getLastButtonPress() > (10 * 60 * 1000))) { && (millis() - getLastButtonPress() > (10 * 60 * 1000))) {

View File

@@ -15,8 +15,8 @@ int32_t computePID(uint16_t setpoint) {
uint16_t currentReading = readIronTemp(0, 1,setpoint); //get the current temp of the iron uint16_t currentReading = readIronTemp(0, 1,setpoint); //get the current temp of the iron
int16_t error = (int16_t) setpoint - (int16_t) currentReading; //calculate the error term int16_t error = (int16_t) setpoint - (int16_t) currentReading; //calculate the error term
ITerm += (pidSettings.ki * error); ITerm += (pidSettings.ki * error);
if (ITerm > MAXPIDOUTPUT) if (ITerm > MAXPIDOUTPUT/2)
ITerm = MAXPIDOUTPUT; ITerm = MAXPIDOUTPUT/2;
else if (ITerm < 0) else if (ITerm < 0)
ITerm = 0; //cap at 0 since we cant force the iron to cool itself :) ITerm = 0; //cap at 0 since we cant force the iron to cool itself :)
@@ -34,8 +34,8 @@ int32_t computePID(uint16_t setpoint) {
} }
/*Sets up the pid values*/ /*Sets up the pid values*/
void setupPID(void) { void setupPID(void) {
pidSettings.kp = 25; pidSettings.kp = 15;
pidSettings.ki = 7; pidSettings.ki = 2;
pidSettings.kd = 2; pidSettings.kd = 3;
} }