Skip to content

Commit

Permalink
Added configuration of en_decoders via LoRaWAN
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed May 8, 2024
1 parent ec7c17a commit ffa7729
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/AppLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// 20240426 Added BLE address initialization after updating via downlink
// 20240427 Added BLE configuration/status via LoRaWAN
// 20240507 Added configuration of max_sensors/rx_flags via LoRaWAN
// 20240508 Added configuration of en_decoders via LoRaWAN
//
//
// ToDo:
Expand Down Expand Up @@ -136,11 +137,11 @@ AppLayer::decodeDownlink(uint8_t port, uint8_t *payload, size_t size)
return CMD_GET_SENSORS_CFG;
}

if ((port == CMD_SET_SENSORS_CFG) && (size == 2))
if ((port == CMD_SET_SENSORS_CFG) && (size == 3))
{
log_d("Set sensors configuration - max_sensors: %u, rx_flags: %u",
payload[0], payload[1]);
weatherSensor.setSensorsCfg(payload[0], payload[1]);
log_d("Set sensors configuration - max_sensors: %u, rx_flags: %u, en_decoders: %u",
payload[0], payload[1], payload[2]);
weatherSensor.setSensorsCfg(payload[0], payload[1], payload[2]);
return 0;
}

Expand Down Expand Up @@ -655,9 +656,11 @@ void AppLayer::getConfigPayload(uint8_t cmd, uint8_t &port, LoraEncoder &encoder
{
uint8_t maxSensors;
uint8_t rxFlags;
weatherSensor.getSensorsCfg(maxSensors, rxFlags);
uint8_t enDecoders;
weatherSensor.getSensorsCfg(maxSensors, rxFlags, enDecoders);
encoder.writeUint8(maxSensors);
encoder.writeUint8(rxFlags);
encoder.writeUint8(enDecoders);
port = CMD_GET_SENSORS_CFG;
}
#if defined(MITHERMOMETER_EN) || defined(THEENGSDECODER_EN)
Expand Down

0 comments on commit ffa7729

Please sign in to comment.