Skip to content

Commit 695a3c2

Browse files
committed
updated the firmware to version 2.3
1 parent 1d691ce commit 695a3c2

File tree

16 files changed

+292
-166
lines changed

16 files changed

+292
-166
lines changed

ReflowController/ReflowController.pde

Lines changed: 72 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
// the parameters that are initialised here are saved as the default profiles into the eeprom on first run
5050
// the all important reflow curve variables:
51-
int idleTemp = 20;
51+
int idleTemp = 50;
5252
int soakTemp = 130;
5353
int soakDuration = 80; //seconds
5454
int peakTemp = 220; // peak temperature (careful!)
@@ -68,8 +68,8 @@ int fanAssistSpeed = 50; // default fan speed
6868
#ifdef DEBUG
6969
#include <MemoryFree.h>
7070
#endif
71-
const unsigned int offsetFanSpeed_ = 30*16; // one byte
72-
const unsigned int offsetProfileNum_ = 30*16+1;//one byte
71+
const unsigned int offsetFanSpeed_ = 30*16+1; // one byte
72+
const unsigned int offsetProfileNum_ = 30*16+2;//one byte
7373

7474

7575
int profileNumber = 0;
@@ -132,7 +132,7 @@ double Setpoint, Input, Output;
132132
unsigned int WindowSize = 100;
133133
unsigned long windowStartTime;
134134

135-
unsigned long startTime, stateChangedTime = 0, lastUpdate = 0, lastDisplayUpdate = 0; // a handful of timer variables
135+
unsigned long startTime, stateChangedTime = 0, lastUpdate = 0, lastDisplayUpdate = 0, lastSerialOutput = 0; // a handful of timer variables
136136

137137
//volatile boolean cycleStart = false;
138138

@@ -299,47 +299,58 @@ boolean getJumperState(){
299299

300300
void updateDisplay(){
301301
lcd.clear();
302+
303+
lcd.print(averageT1,1);
304+
lcd.print((char)223);// degrees symbol!
305+
lcd.print("C ");
306+
307+
lcd.print(averageT2,1);
308+
lcd.print((char)223);// degrees symbol!
309+
lcd.print("C");
310+
311+
if(currentState!=idle){
312+
lcd.setCursor(16,0);
313+
lcd.print((millis() - startTime)/1000);
314+
lcd.print("S");
315+
}
316+
317+
lcd.setCursor(0,1);
302318
switch(currentState){
303319
case idle:
304-
lcd.print("idle ");
320+
lcd.print("Idle ");
305321
break;
306322
case rampToSoak:
307-
lcd.print("ramp ");
323+
lcd.print("Ramp ");
308324
break;
309325
case soak:
310-
lcd.print("soak ");
326+
lcd.print("Soak ");
311327
break;
312328
case rampUp:
313-
lcd.print("rampUp ");
329+
lcd.print("Ramp Up ");
314330
break;
315331
case peak:
316-
lcd.print("peak ");
332+
lcd.print("Peak ");
317333
break;
318334
case rampDown:
319-
lcd.print("rampDown ");
335+
lcd.print("Ramp Down ");
320336
break;
321337
case coolDown:
322-
lcd.print("coolDown ");
338+
lcd.print("Cool Down ");
323339
break;
324-
}
325-
lcd.print(averageT1,1);
326-
lcd.print((char)223);// degrees symbol!
327-
lcd.print("C");
328-
if(currentState!=idle){
329-
lcd.setCursor(16,0);
330-
lcd.print((millis() - startTime)/1000);
331-
lcd.print("S");
332340
}
333-
lcd.setCursor(0,1);
334-
lcd.print("Setpoint = ");
341+
342+
lcd.print("Sp=");
335343
lcd.print(Setpoint,1);
336344
lcd.print((char)223);// degrees symbol!
337345
lcd.print("C");
338346
lcd.setCursor(0,2);
339-
lcd.print("Output = ");
340-
lcd.print((int)Output);
347+
lcd.print("Heat=");
348+
lcd.print((int)heaterValue);
349+
lcd.setCursor(10,2);
350+
lcd.print("Fan=");
351+
lcd.print((int)fanValue);
341352
lcd.setCursor(0,3);
342-
lcd.print("Ramp = ");
353+
lcd.print("Ramp=");
343354
lcd.print(rampRate,1);
344355
lcd.print((char)223);// degrees symbol!
345356
lcd.print("C/S");
@@ -454,7 +465,7 @@ void setup()
454465
lcd.setCursor(0,1);
455466
lcd.print(" Reflow controller");
456467
lcd.setCursor(0,2);
457-
lcd.print(" v2.2");
468+
lcd.print(" v2.3");
458469
#ifdef OPENDRAWER
459470
lcd.setCursor(0,3);
460471
lcd.print(" Albert Lim version");
@@ -468,12 +479,12 @@ void loop()
468479
{
469480

470481
if(millis() - lastUpdate >= 100){
471-
#ifdef DEBUG
482+
#ifdef DEBUG
472483
Serial.print("freeMemory()=");
473484
Serial.println(freeMemory());
474-
#endif
485+
#endif
475486
lastUpdate = millis();
476-
487+
477488
temp1 = getAirTemperature1();
478489
temp2 = getAirTemperature2();
479490
// keep a rolling average of the temp
@@ -515,37 +526,38 @@ void loop()
515526
else {
516527
if(millis() - lastDisplayUpdate > 250){ // 4hz display during reflow cycle
517528
lastDisplayUpdate = millis();
518-
if(currentState != idle){
519-
updateDisplay();
520-
}
521-
Serial.write(currentState); // see the enum for the definition of the states
529+
530+
updateDisplay();
522531

523532
}
524533
}
525534

535+
if(millis() - lastSerialOutput > 250){
536+
lastSerialOutput = millis();
526537

527-
if (currentState != idle)
528-
{
529-
Serial.print((millis() - startTime));
530-
Serial.print(",");
531-
Serial.print((int)currentState);
532-
Serial.print(",");
533-
Serial.print(Setpoint);
534-
Serial.print(",");
535-
Serial.print(heaterValue);
536-
Serial.print(",");
537-
Serial.print(fanValue);
538-
Serial.print(",");
539-
Serial.print(averageT1);
540-
Serial.print(",");
541-
Serial.println(averageT2);
542-
}
543-
else
544-
{
545-
Serial.print("0,0,0,0,0,");
546-
Serial.print(averageT1);
547-
Serial.print(",");
548-
Serial.println(averageT2);
538+
if (currentState == idle)
539+
{
540+
Serial.print("0,0,0,0,0,");
541+
Serial.print(averageT1);
542+
Serial.print(",");
543+
Serial.println(averageT2);
544+
}
545+
else {
546+
547+
Serial.print((millis() - startTime));
548+
Serial.print(",");
549+
Serial.print((int)currentState);
550+
Serial.print(",");
551+
Serial.print(Setpoint);
552+
Serial.print(",");
553+
Serial.print(heaterValue);
554+
Serial.print(",");
555+
Serial.print(fanValue);
556+
Serial.print(",");
557+
Serial.print(averageT1);
558+
Serial.print(",");
559+
Serial.println(averageT2);
560+
}
549561
}
550562

551563

@@ -711,7 +723,7 @@ void loop()
711723

712724

713725
void cycleStart(){
714-
726+
715727
startTime = millis();
716728
currentState = rampToSoak;
717729
#ifdef OPENDRAWER
@@ -721,7 +733,7 @@ void cycleStart(){
721733
lcd.print("Starting cycle ");
722734
lcd.print(profileNumber);
723735
delay(1000);
724-
736+
725737
}
726738

727739
void saveProfile(){
@@ -955,3 +967,7 @@ void loadLastUsedProfile(){
955967
//Serial.println(temp);
956968
}
957969

970+
971+
972+
973+

libraries/LCDMenuDisplay/LCDMenu.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void LCDMenu::init (MenuItem *initial, LiquidCrystal *lcd, boolean fourkey) {
2828

2929
this->Current = initial;
3030
this->Editing = NULL;
31+
update = true;
3132
}
3233

3334
void LCDMenu::showCurrent () {
@@ -99,6 +100,7 @@ void LCDMenu::poll () {
99100
}
100101

101102
if((pressedKey != lastKey) ||((counter % 2 == 0) && (counter >3))){
103+
update = true;
102104
lastKey = pressedKey;
103105
switch (pressedKey) {
104106
case up:
@@ -124,13 +126,15 @@ void LCDMenu::poll () {
124126
case none:
125127
break;
126128
}
127-
}
128-
if (this->Editing == NULL) {
129-
this->showCurrent();
130-
} else {
131-
this->showCurrentValue();
132129
}
133-
130+
if(update){
131+
update = false;
132+
if (this->Editing == NULL) {
133+
this->showCurrent();
134+
} else {
135+
this->showCurrentValue();
136+
}
137+
}
134138
}
135139

136140

libraries/LCDMenuDisplay/LCDMenu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class LCDMenu: public MenuDisplay {
2020
void showCurrentValue();
2121
void init(MenuItem *initial, LiquidCrystal *lcd, boolean fourkey);
2222
void poll();
23+
bool update;
2324

2425
private:
2526
// the pins that we poll for button presses

libraries/MenuBase/MenuBase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class MenuItem {
2020
MenuItem *Previous;
2121
MenuItem *Next;
2222
MenuItem *Parent;
23-
char Name[22];
23+
const char *Name;
24+
const __FlashStringHelper *Name_P;
2425
// int afterName;
2526

2627
virtual void getValueString (char *string) = 0;

libraries/MenuItemAction/MenuItemAction.cpp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,36 @@
1010
#include "Arduino.h"
1111
#include "MenuItemAction.h"
1212

13-
MenuItemAction::MenuItemAction (char *newName, void (*myAction)()) {
14-
strncpy (this->Name, newName, 20);
15-
// Terminate name string if it's too long for the whole string to have fitted
16-
if (strlen(newName) > 20) {
17-
this->Name[19] = '\0';
18-
}
19-
// strcpy(this->Name, "Foo Bar");
13+
MenuItemAction::MenuItemAction () {
14+
this->Name = NULL;
15+
this->Name_P = NULL;
16+
this->Next = NULL;
17+
this->Previous = NULL;
18+
}
19+
20+
MenuItemAction::MenuItemAction (const char *newName, void (*myAction)()) {
21+
MenuItemAction();
22+
this->Name = newName;
23+
this->Name_P = NULL;
2024
this->Next = NULL;
2125
this->Previous = NULL;
2226
TargetAction = myAction;
2327
}
2428

29+
void MenuItemAction::init (const char *newName, void (*myAction)()) {
30+
this->Name = newName;
31+
TargetAction = myAction;
32+
}
33+
34+
void MenuItemAction::init (const __FlashStringHelper *newName_P, void (*myAction)()) {
35+
this->Name_P = newName_P;
36+
TargetAction = myAction;
37+
}
38+
2539
void MenuItemAction::select (MenuDisplay *controller) {
2640
(*TargetAction) ();
2741
}
42+
2843
void MenuItemAction::exit (MenuDisplay *controller) {
2944
if (controller->Editing != NULL) {
3045
controller->Editing = NULL;

libraries/MenuItemAction/MenuItemAction.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515

1616
class MenuItemAction: public MenuItem {
1717
public:
18-
void (*TargetAction) ();
19-
void getValueString (char *string);
20-
MenuItemAction (char *newName, void (*myAction)());
18+
MenuItemAction (void);
19+
MenuItemAction (const char *newName, void (*myAction)());
20+
void init (const char *newName, void (*myAction)());
21+
void init (const __FlashStringHelper *newName_P, void (*myAction)());
2122
void select(MenuDisplay *controller);
2223
void exit(MenuDisplay *controller);
2324
void inc(MenuDisplay *controller);
2425
void dec(MenuDisplay *controller);
26+
27+
private:
28+
void (*TargetAction)();
29+
void getValueString(char *string);
2530
};
2631

2732
#endif

0 commit comments

Comments
 (0)