Changeset - 227e0d971bff
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-09-21 17:46:02
ez@ethanzonca.com
Added prototype eeprom read function, added fix for run-on heating
1 file changed with 29 insertions and 8 deletions:
main.c
29
8
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -275,7 +275,7 @@ void process()
 
    }
 
    
 
    // Kill SSR after elapsed period less than SSR_PERIOD 
 
    if(ticks - last_ssr_on > ssr_output)
 
    if(ticks - last_ssr_on > ssr_output || ssr_output == 0)
 
    {
 
        GPIO_ResetBits(LED_STAT);
 
        GPIO_ResetBits(SSR_PIN);
 
@@ -316,15 +316,32 @@ uint16_t k_p = 1;
 
uint16_t k_i = 1;
 
uint16_t k_d = 1;*/
 
 
#define EEPROM_ADDR_WINDUP_GUARD 	0x0808001C
 
#define EEPROM_ADDR_BOOTTOBREW		0x08080020
 
#define EEPROM_ADDR_K_P			0x8080024
 
#define EEPROM_ADDR_K_I			0x8080028
 
#define EEPROM_ADDR_K_D			0x808002C
 
#define EEPROM_ADDR_WINDUP_GUARD 	0x001C
 
#define EEPROM_ADDR_BOOTTOBREW		0x0020
 
#define EEPROM_ADDR_K_P			0x0024
 
#define EEPROM_ADDR_K_I			0x0028
 
#define EEPROM_ADDR_K_D			0x002C
 
 
#define EEPROM_ADDR_BREWTEMP		0x0030
 
#define EEPROM_ADDR_STEAMTEMP		0x0034
 
 
 
#define EEPROM_ADDR_BREWTEMP		0x8080030
 
#define EEPROM_ADDR_STEAMTEMP		0x8080034
 
#define EEPROM_BASE_ADDR    0x08080000    
 
#define EEPROM_BYTE_SIZE    0x0FFF  
 
/*
 
uint32_t EEPROM_ReadWord(uint16_t Addr)  
 
{  
 
    uint32 *wAddr;  
 
    wAddr=(uint32 *)(EEPROM_BASE_ADDR+Addr);  
 
 
    uint32 res;
 
    res = *wAddr++;
 
 
    while(Length--){  
 
        *Buffer++=*wAddr++;  
 
    }     
 
} 
 
*/
 
 
void save_settings()
 
{
 
@@ -336,6 +353,7 @@ void save_settings()
 
    DATA_EEPROM_ProgramWord(EEPROM_ADDR_K_I, k_i);
 
    DATA_EEPROM_ProgramWord(EEPROM_ADDR_K_D, k_d);
 
    DATA_EEPROM_Lock();
 
    
 
}
 
void save_setpoints()
 
{
 
@@ -349,6 +367,7 @@ void save_setpoints()
 
// TODO: Save/restore temperature setpoint settings
 
void restore_settings()
 
{
 
 
    DATA_EEPROM_Unlock();
 
    while(FLASH_GetStatus()==FLASH_BUSY);
 
    boottobrew = (*(__IO uint32_t*)EEPROM_ADDR_BOOTTOBREW);
 
@@ -372,8 +391,10 @@ void restore_settings()
 
    setpoint_steam = (*(__IO uint32_t*)EEPROM_ADDR_STEAMTEMP);    
 
    
 
    DATA_EEPROM_Lock();
 
 
}
 
 
 
void user_input(uint16_t* to_modify)
 
{
 
    if(CHANGE_ELAPSED) {
0 comments (0 inline, 0 general)