mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-25 14:08:23 -05:00
Fix oregon2 weather protocol (#1642)
This commit is contained in:
parent
5f8e44e7b7
commit
5b9d898202
@ -68,7 +68,7 @@ class FProtoWeatherOregon2 : public FProtoWeatherBase {
|
|||||||
void feed(bool level, uint32_t duration) override {
|
void feed(bool level, uint32_t duration) override {
|
||||||
// oregon v2.1 signal is inverted
|
// oregon v2.1 signal is inverted
|
||||||
ManchesterEvent event = level_and_duration_to_event(!level, duration);
|
ManchesterEvent event = level_and_duration_to_event(!level, duration);
|
||||||
bool data;
|
bool bit_value = false;
|
||||||
|
|
||||||
// low-level bit sequence decoding
|
// low-level bit sequence decoding
|
||||||
if (event == ManchesterEventReset) {
|
if (event == ManchesterEventReset) {
|
||||||
@ -77,18 +77,18 @@ class FProtoWeatherOregon2 : public FProtoWeatherBase {
|
|||||||
decode_data = 0UL;
|
decode_data = 0UL;
|
||||||
decode_count_bit = 0;
|
decode_count_bit = 0;
|
||||||
}
|
}
|
||||||
if (manchester_advance(manchester_saved_state, event, &manchester_saved_state, &data)) {
|
if (manchester_advance(manchester_saved_state, event, &manchester_saved_state, &bit_value)) {
|
||||||
if (have_bit) {
|
if (have_bit) {
|
||||||
if (!prev_bit && data) {
|
if (!prev_bit && bit_value) {
|
||||||
subghz_protocol_blocks_add_bit(1);
|
subghz_protocol_blocks_add_bit(1);
|
||||||
} else if (prev_bit && !data) {
|
} else if (prev_bit && !bit_value) {
|
||||||
subghz_protocol_blocks_add_bit(0);
|
subghz_protocol_blocks_add_bit(0);
|
||||||
} else {
|
} else {
|
||||||
ws_protocol_decoder_oregon2_reset();
|
ws_protocol_decoder_oregon2_reset();
|
||||||
}
|
}
|
||||||
have_bit = false;
|
have_bit = false;
|
||||||
} else {
|
} else {
|
||||||
prev_bit = data;
|
prev_bit = bit_value;
|
||||||
have_bit = true;
|
have_bit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,8 +118,7 @@ class FProtoWeatherOregon2 : public FProtoWeatherBase {
|
|||||||
(data & 0xCCCCCCCC) >> 2;
|
(data & 0xCCCCCCCC) >> 2;
|
||||||
|
|
||||||
ws_oregon2_decode_const_data();
|
ws_oregon2_decode_const_data();
|
||||||
var_bits =
|
var_bits = oregon2_sensor_id_var_bits(OREGON2_SENSOR_ID(data));
|
||||||
oregon2_sensor_id_var_bits(OREGON2_SENSOR_ID(data));
|
|
||||||
|
|
||||||
if (!var_bits) {
|
if (!var_bits) {
|
||||||
// sensor is not supported, stop decoding, but showing the decoded fixed part
|
// sensor is not supported, stop decoding, but showing the decoded fixed part
|
||||||
|
Loading…
x
Reference in New Issue
Block a user