Browse Source

sns: actually load bmx280 fixed address from settings

conversion is not working for signed ints, only unsigned
pull/2516/head
Maxim Prokhorov 2 years ago
parent
commit
c0d6ed1288
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      code/espurna/sensor.cpp

+ 4
- 4
code/espurna/sensor.cpp View File

@ -2583,11 +2583,11 @@ void _sensorLoad() {
// For second sensor, if BMX280_ADDRESS is 0x00 then auto-discover
// otherwise choose the other unnamed sensor address
const auto first = getSetting("bmx280Address", BMX280_ADDRESS);
const auto second = (first == 0x00) ? 0x00 : (0x76 + 0x77 - first);
const decltype(first) address_map[2] { first, second };
static constexpr uint8_t Address { BMX280_ADDRESS };
const decltype(Address) first = getSetting("bmx280Address", Address);
const decltype(Address) second = (first == 0x00) ? 0x00 : (0x76 + 0x77 - first);
const decltype(Address) address_map[2] { first, second };
for (unsigned char n=0; n < number; ++n) {
BMX280Sensor * sensor = new BMX280Sensor();
sensor->setAddress(address_map[n]);


Loading…
Cancel
Save