Compare commits
	
		
			No commits in common. "fb065dc9d2625b1f01b99245e9c8ff6895ad22e1" and "2603bd5fe4c039e06135df5e20e4cfca38d7cbcf" have entirely different histories.
		
	
	
		
			fb065dc9d2
			...
			2603bd5fe4
		
	
		
@ -181,7 +181,7 @@
 | 
				
			|||||||
// Structure definitions
 | 
					// Structure definitions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct rom_t {
 | 
					struct rom_t {
 | 
				
			||||||
    uint16_t epromchk; uint8_t brightness; uint8_t disptimeout; uint16_t vreq; uint16_t vfloat; uint16_t voff; int16_t pause; bool fahrenheit; int16_t tmin; int16_t ttarget; 
 | 
					    uint16_t epromchk; uint8_t brightness; uint8_t disptimeout; uint16_t vreq; uint16_t vfloat; uint16_t voff; int16_t pause; boolean fahrenheit; int16_t tmin; int16_t ttarget; 
 | 
				
			||||||
    int16_t tsanity; int16_t tmax; int16_t tsandays; int16_t tnosan; uint16_t calibration; int16_t pumpdelta; uint16_t pumpafterrun; uint16_t hwv_timer; bool vmul; uint8_t hwv_pwm;
 | 
					    int16_t tsanity; int16_t tmax; int16_t tsandays; int16_t tnosan; uint16_t calibration; int16_t pumpdelta; uint16_t pumpafterrun; uint16_t hwv_timer; bool vmul; uint8_t hwv_pwm;
 | 
				
			||||||
    uint8_t pumpMode; uint8_t ledmode; bool lcdglow; uint8_t holdon; uint8_t nightbright; uint8_t nightsensor; uint8_t relaypwm; bool altfunc;
 | 
					    uint8_t pumpMode; uint8_t ledmode; bool lcdglow; uint8_t holdon; uint8_t nightbright; uint8_t nightsensor; uint8_t relaypwm; bool altfunc;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -516,7 +516,7 @@ void loop() {
 | 
				
			|||||||
                    menuedit=!menuedit;                     // Long press is either exit or entry of a setup function
 | 
					                    menuedit=!menuedit;                     // Long press is either exit or entry of a setup function
 | 
				
			||||||
                    lcd.clear();
 | 
					                    lcd.clear();
 | 
				
			||||||
                    // Show the associated menu option
 | 
					                    // Show the associated menu option
 | 
				
			||||||
                    printMenu(menusel-100,menuedit);
 | 
					                    printMenu(menusel-100,menuedit,rom.fahrenheit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if(!menuedit && romdirty) {             // We are not in edit mode but made the rom "dirty"?
 | 
					                    if(!menuedit && romdirty) {             // We are not in edit mode but made the rom "dirty"?
 | 
				
			||||||
                        if(freset)
 | 
					                        if(freset)
 | 
				
			||||||
@ -564,8 +564,8 @@ void loop() {
 | 
				
			|||||||
            lcd.clear();
 | 
					            lcd.clear();
 | 
				
			||||||
            // Are we editing a setup menu item?
 | 
					            // Are we editing a setup menu item?
 | 
				
			||||||
            if(menuedit) {                                  // Are we in edit mode?
 | 
					            if(menuedit) {                                  // Are we in edit mode?
 | 
				
			||||||
                editItem(menusel-100);                      // Edit the item
 | 
					                editItem(menusel-100, rom.vmul);            // Edit the item
 | 
				
			||||||
                printMenu(menusel-100,menuedit);
 | 
					                printMenu(menusel-100,menuedit,rom.fahrenheit);
 | 
				
			||||||
            } else {                                        // Not in edit mode
 | 
					            } else {                                        // Not in edit mode
 | 
				
			||||||
                if(menusel>=99) {                           // Are we in the setup menu?
 | 
					                if(menusel>=99) {                           // Are we in the setup menu?
 | 
				
			||||||
                    nextMenuItem();                         // Advance to the next menu item
 | 
					                    nextMenuItem();                         // Advance to the next menu item
 | 
				
			||||||
@ -582,7 +582,7 @@ void loop() {
 | 
				
			|||||||
    } else {                                                // No button was pressed
 | 
					    } else {                                                // No button was pressed
 | 
				
			||||||
        if(menusel>=100 && menuedit && getPgmVal(&menu[menusel-100].code)==MENU_SHOW) {
 | 
					        if(menusel>=100 && menuedit && getPgmVal(&menu[menusel-100].code)==MENU_SHOW) {
 | 
				
			||||||
            lcd.setCursor(0,0);
 | 
					            lcd.setCursor(0,0);
 | 
				
			||||||
            printMenu(menusel-100,menuedit);                // This menu option has no timeout
 | 
					            printMenu(menusel-100,menuedit,rom.fahrenheit); // This menu option has no timeout
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            if(menusel && seconds()-menuseltimer>(MENUTIMEOUT)) {
 | 
					            if(menusel && seconds()-menuseltimer>(MENUTIMEOUT)) {
 | 
				
			||||||
@ -669,7 +669,7 @@ void processmodes() {
 | 
				
			|||||||
        lcd.print(F("Tank  "));
 | 
					        lcd.print(F("Tank  "));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    printTemperature(readtemp(src),1);                      // Display the temperature
 | 
					    printTemperature(readtemp(src),1,rom.fahrenheit);       // Display the temperature
 | 
				
			||||||
    if(tempdata[src].failures)                              // If we failed to receive valid data from the sensor...
 | 
					    if(tempdata[src].failures)                              // If we failed to receive valid data from the sensor...
 | 
				
			||||||
        lcd.write('?');                                     // ... indicate this with a question mark...
 | 
					        lcd.write('?');                                     // ... indicate this with a question mark...
 | 
				
			||||||
    else                                                    // ... othersiwse...
 | 
					    else                                                    // ... othersiwse...
 | 
				
			||||||
@ -898,8 +898,8 @@ void heaterState(boolean state) {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    // Take care of the relay PWM if it has been configured
 | 
					    // Take care of the relay PWM if it has been configured
 | 
				
			||||||
    if(state && rom.relaypwm<100 && digitalRead(HEATER) && seconds()-lastChange>2)
 | 
					    if(state && rom.relaypwm<100 && digitalRead(HEATER) && seconds()-lastChange>2)
 | 
				
			||||||
        analogWrite12V(HEATER,rom.relaypwm);
 | 
					        analogWrite(HEATER,((uint16_t)rom.relaypwm*255)/100);// Set the PWM to the desired percentage.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    // If we want to change state, do so only after at least some time has passed since the last change
 | 
					    // If we want to change state, do so only after at least some time has passed since the last change
 | 
				
			||||||
    if((!state && seconds()-lastChange>rom.holdon) || (state && seconds()-lastChange>HOLD_OFF)) {
 | 
					    if((!state && seconds()-lastChange>rom.holdon) || (state && seconds()-lastChange>HOLD_OFF)) {
 | 
				
			||||||
        if(state)                                           // If we switch the heater on...
 | 
					        if(state)                                           // If we switch the heater on...
 | 
				
			||||||
@ -907,11 +907,7 @@ void heaterState(boolean state) {
 | 
				
			|||||||
        if(digitalRead(HEATER)!=state) {                    // Need to change the heater state?
 | 
					        if(digitalRead(HEATER)!=state) {                    // Need to change the heater state?
 | 
				
			||||||
            lastChange=seconds();
 | 
					            lastChange=seconds();
 | 
				
			||||||
            delay(20);
 | 
					            delay(20);
 | 
				
			||||||
            if(state)
 | 
					            digitalWrite(HEATER,state);                     // Switch the heater
 | 
				
			||||||
                analogWrite12V(HEATER,100);                 // Set heater output to 100%
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
                analogWrite12V(HEATER,0);                   // Set heater output to 0%
 | 
					 | 
				
			||||||
//            digitalWrite(HEATER,state);                     // Switch the heater
 | 
					 | 
				
			||||||
            if(rom.hwv_timer && !hwv && state)              // If we have a HWV and it is not on, and we switch on the heater...
 | 
					            if(rom.hwv_timer && !hwv && state)              // If we have a HWV and it is not on, and we switch on the heater...
 | 
				
			||||||
                setHWV(true,HWVBLEED);                      // ... switch on the HWV to equalize the pressure
 | 
					                setHWV(true,HWVBLEED);                      // ... switch on the HWV to equalize the pressure
 | 
				
			||||||
        }        
 | 
					        }        
 | 
				
			||||||
@ -931,28 +927,11 @@ void setHWV(bool state, uint16_t hwvtmr) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    hwv=state;                                              // Register the new state
 | 
					    hwv=state;                                              // Register the new state
 | 
				
			||||||
    if(state)                                               // We want to switch it on
 | 
					    if(state)                                               // We want to switch it on
 | 
				
			||||||
        analogWrite12V(HWV,rom.hwv_pwm);                    // Use PWM for this
 | 
					        analogWrite(HWV,((uint16_t)rom.hwv_pwm*255)/100);   // Use PWM for this
 | 
				
			||||||
    else                                                    // Otherwise
 | 
					    else                                                    // Otherwise
 | 
				
			||||||
        digitalWrite(HWV,LOW);                              // Switch it off
 | 
					        digitalWrite(HWV,LOW);                              // Switch it off
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
void analogWrite12V(uint8_t port,uint8_t percent) {
 | 
					 | 
				
			||||||
    if(percent>=100) {
 | 
					 | 
				
			||||||
        digitalWrite(port,HIGH);                            // Set port to high so we can read back port state
 | 
					 | 
				
			||||||
        if(rom.vmul)                                        // If 24V
 | 
					 | 
				
			||||||
            analogWrite(port,127);                          // Set an initial value of 50%.
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        uint16_t val = ((uint16_t)percent*256)/100;
 | 
					 | 
				
			||||||
        if(rom.vmul)                                        // In case of 24V
 | 
					 | 
				
			||||||
            val/=2;                                         // Divide PWM by 2
 | 
					 | 
				
			||||||
        analogWrite(port,val);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if(!percent)                                            // If we want to switch it completely off
 | 
					 | 
				
			||||||
        digitalWrite(port,LOW);                             // Do a digitalWrite
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// This routine will keep track whether there is a legionella chance
 | 
					// This routine will keep track whether there is a legionella chance
 | 
				
			||||||
boolean sanitycheck() {
 | 
					boolean sanitycheck() {
 | 
				
			||||||
    static boolean sancounting=false;
 | 
					    static boolean sancounting=false;
 | 
				
			||||||
@ -1026,7 +1005,7 @@ void fptr_showTemp() {
 | 
				
			|||||||
    lcd.setCursor(9,1);
 | 
					    lcd.setCursor(9,1);
 | 
				
			||||||
    tempdata[0].mmaTemp.samples=0;
 | 
					    tempdata[0].mmaTemp.samples=0;
 | 
				
			||||||
    tempdata[0].mmaTemp.sum=0;
 | 
					    tempdata[0].mmaTemp.sum=0;
 | 
				
			||||||
    printTemperature(readtemp(0),1);
 | 
					    printTemperature(readtemp(0),1,rom.fahrenheit);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fptr_pumpsource() {
 | 
					void fptr_pumpsource() {
 | 
				
			||||||
@ -1048,9 +1027,9 @@ void fptr_pumpsource() {
 | 
				
			|||||||
void fptr_showtemps() {
 | 
					void fptr_showtemps() {
 | 
				
			||||||
    lcd.setCursor(5,1);
 | 
					    lcd.setCursor(5,1);
 | 
				
			||||||
    if(sensors.useDS && sensors.temphwa[1][0]) {
 | 
					    if(sensors.useDS && sensors.temphwa[1][0]) {
 | 
				
			||||||
        printTemperature(readtemp(0),0);
 | 
					        printTemperature(readtemp(0),0,rom.fahrenheit);
 | 
				
			||||||
        lcd.print(" ");
 | 
					        lcd.print(" ");
 | 
				
			||||||
        printTemperature(readtemp(1),0);
 | 
					        printTemperature(readtemp(1),0,rom.fahrenheit);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        lcd.print("N/A");
 | 
					        lcd.print("N/A");
 | 
				
			||||||
        swapTsens=false;
 | 
					        swapTsens=false;
 | 
				
			||||||
@ -1123,7 +1102,7 @@ void fptr_serialnr() {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printMenu(uint8_t item, boolean edit) {
 | 
					void printMenu(uint8_t item, boolean edit, boolean fahrenheit) {
 | 
				
			||||||
    uint8_t code = getPgmVal(&menu[item].code);
 | 
					    uint8_t code = getPgmVal(&menu[item].code);
 | 
				
			||||||
    uint16_t value = getRomValue(code,item);
 | 
					    uint16_t value = getRomValue(code,item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1147,7 +1126,7 @@ void printMenu(uint8_t item, boolean edit) {
 | 
				
			|||||||
        if(code & (MENU_8 | MENU_16)) {
 | 
					        if(code & (MENU_8 | MENU_16)) {
 | 
				
			||||||
            if(code & MENU_FLOAT)
 | 
					            if(code & MENU_FLOAT)
 | 
				
			||||||
                if(code & MENU_TEMP)
 | 
					                if(code & MENU_TEMP)
 | 
				
			||||||
                    printTemperature(value,0);
 | 
					                    printTemperature(value,0,fahrenheit);
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                    lcd.print((float) ((float)value/pow(10.0,(float)(code & MENU_FLOAT))), code & MENU_FLOAT);
 | 
					                    lcd.print((float) ((float)value/pow(10.0,(float)(code & MENU_FLOAT))), code & MENU_FLOAT);
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -1188,7 +1167,7 @@ uint16_t getRomValue(uint8_t code, uint8_t item) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void editItem(uint8_t item) {
 | 
					void editItem(uint8_t item, bool vmul) {
 | 
				
			||||||
    uint8_t code = getPgmVal(&menu[item].code);
 | 
					    uint8_t code = getPgmVal(&menu[item].code);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if(code==MENU_SHOW)
 | 
					    if(code==MENU_SHOW)
 | 
				
			||||||
@ -1202,7 +1181,7 @@ void editItem(uint8_t item) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    romdirty=true;                                          // Remember to save changes in EEPROM
 | 
					    romdirty=true;                                          // Remember to save changes in EEPROM
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if(code & MENU_VOLTS && rom.vmul) {                     // If some voltage menu option is selected and we operate on a 24V system...
 | 
					    if(code & MENU_VOLTS && vmul) {                         // If some voltage menu option is selected and we operate on a 24V system...
 | 
				
			||||||
        step*=2; max*=2; min*=2;                            // Multiply all voltage steps, minimums and maximums by two.
 | 
					        step*=2; max*=2; min*=2;                            // Multiply all voltage steps, minimums and maximums by two.
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1234,7 +1213,7 @@ void nextMenuItem() {
 | 
				
			|||||||
            menusel=100;                                    // Reached the last one, rewind to the first one
 | 
					            menusel=100;                                    // Reached the last one, rewind to the first one
 | 
				
			||||||
        fn=getPgmVal(&menu[menusel-100].sfx);
 | 
					        fn=getPgmVal(&menu[menusel-100].sfx);
 | 
				
			||||||
    } while((rom.altfunc && ( fn & NOALT)) || (!rom.altfunc && (fn & FNALT)) );
 | 
					    } while((rom.altfunc && ( fn & NOALT)) || (!rom.altfunc && (fn & FNALT)) );
 | 
				
			||||||
    printMenu(menusel-100,menuedit);
 | 
					    printMenu(menusel-100,menuedit,rom.fahrenheit);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1382,8 +1361,8 @@ const char* pgmLcdPrint(const char *txt) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printTemperature(int16_t value,uint8_t precision) {
 | 
					void printTemperature(int16_t value,uint8_t precision, boolean fahrenheit) {
 | 
				
			||||||
    if(rom.fahrenheit) {
 | 
					    if(fahrenheit) {
 | 
				
			||||||
        lcd.print(((float)value*0.18)+32.0,precision);
 | 
					        lcd.print(((float)value*0.18)+32.0,precision);
 | 
				
			||||||
        lcd.print("\xDF""F");
 | 
					        lcd.print("\xDF""F");
 | 
				
			||||||
        if(precision && (float)value*0.18+32.0<100)
 | 
					        if(precision && (float)value*0.18+32.0<100)
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user