2 Commits

Author SHA1 Message Date
bb81f2d6de Fixed negative temperature bug. 2024-01-08 14:44:06 +01:00
2038a1aa9d Fixed inverted digital output pin 2023-12-19 21:00:57 +01:00
9 changed files with 33740 additions and 33715 deletions

View File

@@ -52,3 +52,13 @@ First (more or less) working version.
### Fixed
- Struct for saving settings to FLASH is now 256 bytes excactly (problem with padding done by the compiler)
## [1.1.1] - 2023-12-19
### Fixed
- One of the digital outputs was inverted.
## [1.1.2] - [2024-01-08]
### Fixed
- Negative temperature where converted wrong: -1 became -32767. This was because of a weird format the sensor uses.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -188,7 +188,7 @@ void setup(void)
Status.PowerSupply24V = OFF;
gpio_put(PowerSupply12VControl, 0);
Status.PowerSupply12V = OFF;
gpio_put(PowerSupply5VControl, 1);
gpio_put(PowerSupply5VControl, 0);
Status.PowerSupply5V = OFF;
gpio_put(RelayOffControl, 1);
@@ -715,12 +715,12 @@ int main() {
break;
// Switch off 5V power supply
case 34 :
gpio_put(PowerSupply5VControl, 1);
gpio_put(PowerSupply5VControl, 0);
Status.PowerSupply5V = OFF;
break;
// Switch on 5V power supply
case 35 :
gpio_put(PowerSupply5VControl, 0);
gpio_put(PowerSupply5VControl, 1);
Status.PowerSupply5V = ON;
break;
// Switch off relay
@@ -758,6 +758,12 @@ int main() {
if (!NO_I2C_AVAILABLE)
ReadAM2315(&humidity, &temperature);
// Bit 15 of AM2315 temperature is sign (1 = negative). Bit 14-0 is absolute value of teperature
if (temperature&0x8000) {
temperature = temperature & 0x7FFF; // remove sign bit
temperature = -temperature; // make proper signed integer of negative number
}
// Format telemetry string
sprintf(tmp_string, "%.1f,%.1f", (float)temperature/10, (float)humidity/10);
// Copy string (including NULL terminator) to final destination (can not be done without temporary string due to char/uint8_t issues)