Poll ADC mode bit until conversion has finished
This commit is contained in:
17
src/main.c
17
src/main.c
@@ -60,7 +60,7 @@ static int Init(void)
|
||||
PWM_Init();
|
||||
|
||||
MOS_Enable(MOS03); // Lights
|
||||
// MOS_Enable(MOS01); // Peltier
|
||||
MOS_Enable(MOS01); // Peltier
|
||||
// MOS_Disable(MOS02); // Heating
|
||||
|
||||
// Only FAN01 and FAN02 are receiving the correct
|
||||
@@ -73,7 +73,7 @@ static int Init(void)
|
||||
// complicated so it might be worth it to switch to
|
||||
// something like an ATmega328PB.
|
||||
|
||||
PWM_SetValue(FAN01, 50); // Fan Peltier Hot side
|
||||
PWM_SetValue(FAN01, 20); // Fan Peltier Hot side
|
||||
PWM_SetValue(FAN02, 50); // Fan Peltier Cold Side
|
||||
// PWM_SetValue(FAN03, 20); // Fan Heating
|
||||
|
||||
@@ -99,7 +99,7 @@ static void Update(void)
|
||||
float temp[3], rh[3];
|
||||
float adct[3];
|
||||
|
||||
// Info("Reading sensor values...");
|
||||
Info("Reading sensor values...");
|
||||
|
||||
I2C_SetChannel(AHT01);
|
||||
I2C_AHT20_Read(&temp[0], &rh[0]);
|
||||
@@ -110,18 +110,13 @@ static void Update(void)
|
||||
I2C_SetChannel(AHT03);
|
||||
I2C_AHT20_Read(&temp[2], &rh[2]);
|
||||
|
||||
Sleep(200); // FIXME: Poll config register until BIT(15) == 1
|
||||
adct[0] = I2C_ADS1115_ReadThermistor(ADS01);
|
||||
Sleep(200); // FIXME: Remove me - see above.
|
||||
adct[1] = I2C_ADS1115_ReadThermistor(ADS02);
|
||||
Sleep(200); // FIXME: Remove me - see above.
|
||||
adct[2] = I2C_ADS1115_ReadThermistor(ADS03);
|
||||
|
||||
Info("TEMP0=%.2fC, RH0=%.2f%%", temp[0], rh[0]);
|
||||
Info("TEMP1=%.2fC, RH1=%.2f%%", temp[1], rh[1]);
|
||||
Info("TEMP2=%.2fC, RH2=%.2f%%", temp[2], rh[2]);
|
||||
Info("ADCT1=%.2fC, ADCT2=%.2fC", adct[0], adct[1]);
|
||||
Info("ADCT3=%.2fC", adct[2]);
|
||||
Info("TEMP1=%.2fC, RH1=%.2f%% ADCT1=%.2fC", temp[0], rh[0], adct[0]);
|
||||
Info("TEMP2=%.2fC, RH2=%.2f%% ADCT2=%.2fC", temp[1], rh[1], adct[1]);
|
||||
Info("TEMP3=%.2fC, RH3=%.2f%% ADCT3=%.2fC", temp[2], rh[2], adct[2]);
|
||||
|
||||
// TODO: Implement state machine
|
||||
|
||||
|
||||
Reference in New Issue
Block a user