Set FAN03 to maximum duty and declutter log output

This commit is contained in:
2024-09-15 21:33:12 +02:00
parent 1cc319cd38
commit ce1444b0f4
2 changed files with 19 additions and 10 deletions

View File

@@ -96,11 +96,12 @@ int PWM_Init(void)
// TIMER2: Fast mode, non-inverting, top=0xFF, prescale /8 // TIMER2: Fast mode, non-inverting, top=0xFF, prescale /8
// TOP set to 8000000 (f_cpu) / 8 (prescale) / 25000 (f_pwm) - 1 // TOP set to 8000000 (f_cpu) / 8 (prescale) / 25000 (f_pwm) - 1
// TCCR2 = BIT(WGM20) | BIT(WGM21) | BIT(COM21) | BIT(CS21); TCCR2 = BIT(WGM20) | BIT(WGM21) | BIT(COM21) | BIT(CS21);
// OCR2 = 40 - 1; // XXX: OCR2A=TOP OCR2B=duty OCR2 = 255; // XXX: OCR2A=TOP OCR2B=duty
TCCR2 = 0; // Normal operation // TCCR2 = 0; // Normal operation
OCR2 = FAN03_MIN_DUTY; // PD7 // OCR2 = FAN03_MIN_DUTY; // PD7
// PORTD &= ~BIT(PD7); // Low
return 0; return 0;
} }

View File

@@ -59,8 +59,9 @@ static int Init(void)
I2C_Init(); I2C_Init();
PWM_Init(); PWM_Init();
MOS_Enable(MOS03); MOS_Enable(MOS03); // Lights
// MOS_Disable(MOS01); // MOS_Enable(MOS01); // Peltier
// MOS_Disable(MOS02); // Heating
// Only FAN01 and FAN02 are receiving the correct // Only FAN01 and FAN02 are receiving the correct
// frequency (25 KHz) right now. The 16-bit timer on // frequency (25 KHz) right now. The 16-bit timer on
@@ -98,7 +99,7 @@ static void Update(void)
float temp[3], rh[3]; float temp[3], rh[3];
float adct[3]; float adct[3];
Info("Reading sensor values..."); // Info("Reading sensor values...");
I2C_SetChannel(AHT01); I2C_SetChannel(AHT01);
I2C_AHT20_Read(&temp[0], &rh[0]); I2C_AHT20_Read(&temp[0], &rh[0]);
@@ -116,9 +117,16 @@ static void Update(void)
Sleep(200); // FIXME: Remove me - see above. Sleep(200); // FIXME: Remove me - see above.
adct[2] = I2C_ADS1115_ReadThermistor(ADS03); adct[2] = I2C_ADS1115_ReadThermistor(ADS03);
Info("TEMP0=%.2fC, TEMP1=%.2fC, TEMP2=%.2fC", temp[0], temp[1], temp[2]); Info("TEMP0=%.2fC, RH0=%.2f%%", temp[0], rh[0]);
Info("ADCT0=%.2fC, ADCT1=%.2fC, ADCT2=%.2fC", adct[0], adct[1], adct[2]); Info("TEMP1=%.2fC, RH1=%.2f%%", temp[1], rh[1]);
Info("RH0=%.2f%%, RH1=%.2f%%, RH2=%.2f%%", rh[0], rh[1], rh[2]); Info("TEMP2=%.2fC, RH2=%.2f%%", temp[2], rh[2]);
Info("ADCT1=%.2fC, ADCT2=%.2fC", adct[0], adct[1]);
Info("ADCT3=%.2fC", adct[2]);
// TODO: Implement state machine
// Inputs: TEMP, DEWP
// States: IDLE, DEHUMIDIFY, HEATUP, COOLDOWN
} }
int main(void) int main(void)