mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge #472 --nobuild
This commit is contained in:
@@ -150,10 +150,19 @@ const uint8_t subghz_device_cc1101_preset_ook_650khz_async_regs[] = {
|
||||
};
|
||||
|
||||
const uint8_t subghz_device_cc1101_preset_ook_650khz_async_regs_better_q[] = {
|
||||
// https://www.youtube.com/@MrDerekJamison
|
||||
//0x02, 0x0D, 0x03, 0x07, 0x08, 0x32, 0x0B, 0x06, 0x14, 0x00, 0x13, 0x00, 0x12, 0x30, 0x11, 0x22, 0x10, 0x1C, 0x18, 0x18, 0x19, 0x18, 0x1D, 0x91, 0x1C, 0x00, 0x1B, 0x07, 0x20, 0xFB, 0x22, 0x11, 0x21, 0xB6, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
// correzione e ulteriore implementazione da HAISENTECK
|
||||
CC1101_IOCFG0, 0x0D, CC1101_FIFOTHR, 0x07, CC1101_PKTCTRL0, 0x32, 0x0B, 0x06, 0x14, 0x00, 0x13, 0x00, 0x12, 0x30, 0x11, 0x32, 0x10, 0x17, 0x18, 0x18, 0x19, 0x18, 0x1D, 0x91, 0x1C, 0x00, 0x1B, 0x07, 0x20, 0xFB, 0x22, 0x11, 0x21, 0xB6, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// https://www.youtube.com/@MrDerekJamison
|
||||
//0x02, 0x0D, 0x03, 0x07, 0x08, 0x32, 0x0B, 0x06, 0x14, 0x00, 0x13, 0x00, 0x12, 0x30, 0x11, 0x22, 0x10, 0x1C, 0x18, 0x18, 0x19, 0x18, 0x1D, 0x91, 0x1C, 0x00, 0x1B, 0x07, 0x20, 0xFB, 0x22, 0x11, 0x21, 0xB6, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
// correzione e ulteriore implementazione da HAISENTECK
|
||||
CC1101_IOCFG0, 0x0D, CC1101_FIFOTHR, 0x07, CC1101_PKTCTRL0,
|
||||
0x32, 0x0B, 0x06, 0x14, 0x00,
|
||||
0x13, 0x00, 0x12, 0x30, 0x11,
|
||||
0x32, 0x10, 0x17, 0x18, 0x18,
|
||||
0x19, 0x18, 0x1D, 0x91, 0x1C,
|
||||
0x00, 0x1B, 0x07, 0x20, 0xFB,
|
||||
0x22, 0x11, 0x21, 0xB6, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00,
|
||||
};
|
||||
|
||||
const uint8_t subghz_device_cc1101_preset_2fsk_dev2_38khz_async_regs[] = {
|
||||
|
||||
@@ -36,7 +36,8 @@ static void subghz_device_cc1101_int_interconnect_load_preset(
|
||||
furi_hal_subghz_load_custom_preset(subghz_device_cc1101_preset_ook_270khz_async_regs);
|
||||
break;
|
||||
case FuriHalSubGhzPresetOok650Async_q:
|
||||
furi_hal_subghz_load_custom_preset(subghz_device_cc1101_preset_ook_650khz_async_regs_better_q);
|
||||
furi_hal_subghz_load_custom_preset(
|
||||
subghz_device_cc1101_preset_ook_650khz_async_regs_better_q);
|
||||
break;
|
||||
case FuriHalSubGhzPreset2FSKDev238Async:
|
||||
furi_hal_subghz_load_custom_preset(subghz_device_cc1101_preset_2fsk_dev2_38khz_async_regs);
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
//
|
||||
// Actual protocol can be found at http://kbase.x10.com/wiki/CM17A_Protocol
|
||||
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_x10_const = {
|
||||
.te_short = 600,
|
||||
.te_long = 1800,
|
||||
@@ -126,7 +125,7 @@ bool subghz_protocol_x10_validate(void* context) {
|
||||
|
||||
return decoder->decode_count_bit >= subghz_protocol_x10_const.min_count_bit_for_found &&
|
||||
((((data >> 24) ^ (data >> 16)) & 0xFF) == 0xFF) &&
|
||||
((((data >> 8) ^ (data )) & 0xFF) == 0xFF);
|
||||
((((data >> 8) ^ (data)) & 0xFF) == 0xFF);
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_x10_feed(void* context, bool level, uint32_t duration) {
|
||||
@@ -157,7 +156,7 @@ void subghz_protocol_decoder_x10_feed(void* context, bool level, uint32_t durati
|
||||
if(instance->decoder.decode_count_bit ==
|
||||
subghz_protocol_x10_const.min_count_bit_for_found) {
|
||||
instance->decoder.parser_step = X10DecoderStepReset;
|
||||
if (subghz_protocol_x10_validate(context)) {
|
||||
if(subghz_protocol_x10_validate(context)) {
|
||||
FURI_LOG_E(TAG, "Decoded a signal!");
|
||||
instance->generic.data = instance->decoder.decode_data;
|
||||
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
|
||||
@@ -207,7 +206,7 @@ void subghz_protocol_decoder_x10_feed(void* context, bool level, uint32_t durati
|
||||
* @param instance Pointer to a SubGhzBlockGeneric* instance
|
||||
*/
|
||||
static void subghz_protocol_x10_check_remote_controller(SubGhzBlockGeneric* instance) {
|
||||
instance->serial = (instance->data & 0xF0000000) >> (24+4);
|
||||
instance->serial = (instance->data & 0xF0000000) >> (24 + 4);
|
||||
instance->btn = (((instance->data & 0x07000000) >> 24) | ((instance->data & 0xF800) >> 8));
|
||||
}
|
||||
|
||||
@@ -236,8 +235,7 @@ SubGhzProtocolStatus
|
||||
if(!subghz_block_generic_deserialize(&instance->generic, flipper_format)) {
|
||||
break;
|
||||
}
|
||||
if(instance->generic.data_count_bit !=
|
||||
subghz_protocol_x10_const.min_count_bit_for_found) {
|
||||
if(instance->generic.data_count_bit != subghz_protocol_x10_const.min_count_bit_for_found) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
break;
|
||||
}
|
||||
@@ -254,17 +252,15 @@ void subghz_protocol_decoder_x10_get_string(void* context, FuriString* output) {
|
||||
|
||||
char code_channel = CHANNEL_LETTERS[(instance->generic.serial & 0x0F)];
|
||||
|
||||
uint32_t code_button = 1 + (
|
||||
((instance->generic.btn&0x10) >> 4) |
|
||||
((instance->generic.btn&0x8) >> 2) |
|
||||
((instance->generic.btn&0x40)>>4) |
|
||||
((instance->generic.btn&4)<<1));
|
||||
uint32_t code_button =
|
||||
1 + (((instance->generic.btn & 0x10) >> 4) | ((instance->generic.btn & 0x8) >> 2) |
|
||||
((instance->generic.btn & 0x40) >> 4) | ((instance->generic.btn & 4) << 1));
|
||||
|
||||
char* code_action = (instance->generic.btn & 0x20) == 0x20 ? "Off" : "On";
|
||||
if (instance->generic.btn == 0x98) {
|
||||
if(instance->generic.btn == 0x98) {
|
||||
code_button = 0;
|
||||
code_action = "Dim";
|
||||
} else if (instance->generic.btn == 0x88) {
|
||||
} else if(instance->generic.btn == 0x88) {
|
||||
code_button = 0;
|
||||
code_action = "Bright";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user