diff --git a/CHANGELOG.md b/CHANGELOG.md index a85a803de..960e17a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ - Enforce int module (like in OFW) usage due to lack of required hardware on external boards (PathIsolate (+rf switch for multiple paths)) and incorrect usage and/or understanding the purpose of frequency analyzer app by users, it should be used only to get frequency of the remote placed around 1-10cm around flipper's left corner - Fix possible GSM mobile towers signal interference by limiting upper frequency to 920mhz max - Fix duplicated frequency lists and use user config for nearest frequency selector too + - Nexus-TH weather station protocol improvements on detection (#256 by @m7i-org) - Infrared: - Additions to MNTM specific LED, Digital Sign, Monitor universal remotes from IRDB (#240 by @jaylikesbunda) - UL: Replace LEDs universal remote with new one by Unleashed team, includes color options (by @amec0e & @xMasterX) diff --git a/lib/subghz/protocols/nexus_th.c b/lib/subghz/protocols/nexus_th.c index 0ed331967..6a0585af7 100644 --- a/lib/subghz/protocols/nexus_th.c +++ b/lib/subghz/protocols/nexus_th.c @@ -101,11 +101,30 @@ void ws_protocol_decoder_nexus_th_reset(void* context) { static bool ws_protocol_nexus_th_check(WSProtocolDecoderNexus_TH* instance) { uint8_t type = (instance->decoder.decode_data >> 8) & 0x0F; - if((type == NEXUS_TH_CONST_DATA) && ((instance->decoder.decode_data >> 4) != 0xffffffff)) { - return true; - } else { - return false; - } + if(type != NEXUS_TH_CONST_DATA) return false; + if((instance->decoder.decode_data >> 4) == 0xffffffff) return false; + + if(!((instance->decoder.decode_data >> 23) & 1) && + ((instance->decoder.decode_data >> 12) & 0x07FF) > 1000) + return false; // temp>100C + if(((instance->decoder.decode_data >> 23) & 1) && + (~(instance->decoder.decode_data >> 12) & 0x07FF) > 500) + return false; // temp<-50C + if((instance->decoder.decode_data & 0xFF) > 100) return false; // hum>100 + + // The nexus protocol will trigger on rubicson data, so calculate the rubicson crc and make sure + // it doesn't match. By guesstimate it should generate a correct crc 1/255% of the times. + // So less then 0.5% which should be acceptable. + uint8_t msg_rubicson_crc[] = { + instance->decoder.decode_data >> 28, + instance->decoder.decode_data >> 20, + instance->decoder.decode_data >> 12, + 0xf0, + (instance->decoder.decode_data & 0xf0) | (instance->decoder.decode_data & 0x0f)}; + + if(subghz_protocol_blocks_crc8(msg_rubicson_crc, 5, 0x31, 0x6c) == 0) + return false; // rubicson match, probably not a Nexus + return true; } @@ -214,6 +233,8 @@ static void ws_protocol_nexus_th_remote_controller(WSBlockGeneric* instance) { instance->humidity = instance->data & 0xFF; if(instance->humidity > 95) instance->humidity = 95; + else if(instance->humidity == 0) + instance->humidity = WS_NO_HUMIDITY; else if(instance->humidity < 20) instance->humidity = 20; }