not sure if this is it!

This commit is contained in:
Daniël Koek 2024-04-08 19:37:39 +01:00
parent 070026dcbf
commit 5be241d1c0
2 changed files with 6 additions and 4 deletions

View file

@ -56,8 +56,8 @@ struct RegisterConfig {
uint8_t command : 8;
uint8_t starting_address : 8;
uint8_t length : 8;
int addh : 8;
int addl : 8;
uint8_t addh : 8;
uint8_t addl : 8;
struct {
uint8_t air_data_rate : 3;
uint8_t parity : 2;
@ -71,7 +71,7 @@ struct RegisterConfig {
uint8_t sub_packet : 2;
} reg_1;
// reg2
int channel : 8;
uint8_t channel : 8;
struct {
uint8_t wor_period : 3;
uint8_t reserve1 : 1;

View file

@ -350,7 +350,9 @@ void EbyteLoraComponent::loop() {
}
if (data[0] == PROGRAM_CONF) {
ESP_LOGD(TAG, "GOT PROGRAM_CONF");
memcpy(&this->config, &data, data.size());
auto *sbuff = reinterpret_cast<const RegisterConfig *>(&data);
memset(&this->config, 0, sizeof(RegisterConfig));
memcpy(&this->config, sbuff, sbuff->length);
set_mode_(NORMAL);
}
}