void Reflow_LoadCustomProfiles(void) { EEPROM_Read((uint8_t*)ee1.temperatures, 2, 96); ByteswapTempProfile(ee1.temperatures); EEPROM_Read((uint8_t*)ee2.temperatures, 128 + 2, 96); ByteswapTempProfile(ee2.temperatures); }
void Reflow_Init(void) { // PID_init(&PID,16,0.1,2,PID_Direction_Direct); PID_init(&PID,17,0.11,2,PID_Direction_Direct); EEPROM_Read((uint8_t*)ee1.temperatures, 2, 96); ByteswapTempProfile(ee1.temperatures); EEPROM_Read((uint8_t*)ee2.temperatures, 128+2, 96); ByteswapTempProfile(ee2.temperatures); intsetpoint = 30; PID.mySetpoint = 30.0f; // Default setpoint PID_SetOutputLimits(&PID, 0,255+248); PID_SetMode(&PID, PID_Mode_Manual); PID.myOutput = 248; // Between fan and heat PID_SetMode(&PID, PID_Mode_Automatic); RTC_Zero(); }
int Reflow_SaveEEProfile(void) { int retval = 0; uint8_t offset; uint16_t* tempptr; if(profileidx == (NUMPROFILES - 2)) { offset = 0; tempptr = ee1.temperatures; } else if( profileidx == (NUMPROFILES - 1)) { offset = 128; tempptr = ee2.temperatures; } else { return -1; } offset += 2; // Skip "magic" ByteswapTempProfile(tempptr); retval = EEPROM_Write(offset, (uint8_t*)tempptr, 96); // Store ByteswapTempProfile(tempptr); return retval; }