mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-18 19:01:47 +03:00
Update came_atomo.c
code make-up, fix pause to 68ms
This commit is contained in:
parent
d057c63344
commit
a29e34c3f4
@ -133,23 +133,28 @@ static void subghz_protocol_encoder_came_atomo_get_upload(SubGhzProtocolEncoderC
|
|||||||
ManchesterEncoderResult result;
|
ManchesterEncoderResult result;
|
||||||
|
|
||||||
uint8_t pack[8] = {};
|
uint8_t pack[8] = {};
|
||||||
pack[0] = (instance->generic.data_2 >> 56); pack[1] = ((instance->generic.data_2 >> 48) & 0xFF); pack[2] = ((instance->generic.data_2 >> 40) & 0xFF); pack[3] = ((instance->generic.data_2 >> 32) & 0xFF);
|
pack[0] = (instance->generic.data_2 >> 56); pack[1] = ((instance->generic.data_2 >> 48) & 0xFF);
|
||||||
pack[4] = ((instance->generic.data_2 >> 24) & 0xFF); pack[5] = ((instance->generic.data_2 >> 16) & 0xFF); pack[6] = ((instance->generic.data_2 >> 8) & 0xFF); pack[7] = (instance->generic.data_2 & 0xFF);
|
pack[2] = ((instance->generic.data_2 >> 40) & 0xFF); pack[3] = ((instance->generic.data_2 >> 32) & 0xFF);
|
||||||
|
pack[4] = ((instance->generic.data_2 >> 24) & 0xFF); pack[5] = ((instance->generic.data_2 >> 16) & 0xFF);
|
||||||
|
pack[6] = ((instance->generic.data_2 >> 8) & 0xFF); pack[7] = (instance->generic.data_2 & 0xFF);
|
||||||
|
|
||||||
FURI_LOG_I(TAG, "encoder prepared: %02X %02X %02X %02X %02X %02X %02X %02X\n", pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
FURI_LOG_I(TAG, "encoder prepared: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||||
|
pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
||||||
|
|
||||||
atomo_encrypt(pack);
|
atomo_encrypt(pack);
|
||||||
uint32_t hi = pack[0] << 24 | pack[1] << 16 | pack[2] << 8 | pack[3];
|
uint32_t hi = pack[0] << 24 | pack[1] << 16 | pack[2] << 8 | pack[3];
|
||||||
uint32_t lo = pack[4] << 24 | pack[5] << 16 | pack[6] << 8 | pack[7];
|
uint32_t lo = pack[4] << 24 | pack[5] << 16 | pack[6] << 8 | pack[7];
|
||||||
instance->generic.data = (uint64_t)hi << 32 | lo;
|
instance->generic.data = (uint64_t)hi << 32 | lo;
|
||||||
FURI_LOG_I(TAG, "encrypted data: %02X %02X %02X %02X %02X %02X %02X %02X\n", pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
FURI_LOG_I(TAG, "encrypted data: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||||
|
pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
||||||
|
|
||||||
uint64_t invert = instance->generic.data ^ 0xFFFFFFFFFFFFFFFF;
|
uint64_t invert = instance->generic.data ^ 0xFFFFFFFFFFFFFFFF;
|
||||||
invert >>= 4;
|
invert >>= 4;
|
||||||
invert = (uint64_t)0x1 << 60 | invert;
|
invert = (uint64_t)0x1 << 60 | invert;
|
||||||
hi = invert >> 32;
|
hi = invert >> 32;
|
||||||
lo = invert & 0xFFFFFFFF;
|
lo = invert & 0xFFFFFFFF;
|
||||||
FURI_LOG_I(TAG, "inverted to upload: %02X %02X %02X %02X %02X %02X %02X %02X\n", (hi >> 24), ((hi >> 16) & 0xFF), ((hi >> 8) & 0xFF), (hi & 0xFF),
|
FURI_LOG_I(TAG, "inverted to upload: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||||
|
(hi >> 24), ((hi >> 16) & 0xFF), ((hi >> 8) & 0xFF), (hi & 0xFF),
|
||||||
(lo >> 24), ((lo >> 16) & 0xFF), ((lo >> 8) & 0xFF), (lo & 0xFF));
|
(lo >> 24), ((lo >> 16) & 0xFF), ((lo >> 8) & 0xFF), (lo & 0xFF));
|
||||||
|
|
||||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||||
@ -168,7 +173,7 @@ static void subghz_protocol_encoder_came_atomo_get_upload(SubGhzProtocolEncoderC
|
|||||||
}
|
}
|
||||||
//pause
|
//pause
|
||||||
instance->encoder.upload[index++] =
|
instance->encoder.upload[index++] =
|
||||||
level_duration_make(false, (uint32_t)subghz_protocol_came_atomo_const.te_short * 113);
|
level_duration_make(false, (uint32_t)subghz_protocol_came_atomo_const.te_delta * 272);
|
||||||
|
|
||||||
instance->encoder.size_upload = index;
|
instance->encoder.size_upload = index;
|
||||||
}
|
}
|
||||||
@ -393,13 +398,17 @@ static void subghz_protocol_came_atomo_remote_controller(
|
|||||||
instance->data <<= 4;
|
instance->data <<= 4;
|
||||||
uint32_t hi = instance->data >> 32;
|
uint32_t hi = instance->data >> 32;
|
||||||
uint32_t lo = instance->data & 0xFFFFFFFF;
|
uint32_t lo = instance->data & 0xFFFFFFFF;
|
||||||
FURI_LOG_I(TAG, "inverted data: %02X %02X %02X %02X %02X %02X %02X %02X\n", (hi >> 24), ((hi >> 16) & 0xFF), ((hi >> 8) & 0xFF), (hi & 0xFF),
|
FURI_LOG_I(TAG, "inverted data: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||||
|
(hi >> 24), ((hi >> 16) & 0xFF), ((hi >> 8) & 0xFF), (hi & 0xFF),
|
||||||
(lo >> 24), ((lo >> 16) & 0xFF), ((lo >> 8) & 0xFF), (lo & 0xFF));
|
(lo >> 24), ((lo >> 16) & 0xFF), ((lo >> 8) & 0xFF), (lo & 0xFF));
|
||||||
uint8_t pack[8] = {};
|
uint8_t pack[8] = {};
|
||||||
pack[0] = (instance->data >> 56); pack[1] = ((instance->data >> 48) & 0xFF); pack[2] = ((instance->data >> 40) & 0xFF); pack[3] = ((instance->data >> 32) & 0xFF);
|
pack[0] = (instance->data >> 56); pack[1] = ((instance->data >> 48) & 0xFF);
|
||||||
pack[4] = ((instance->data >> 24) & 0xFF); pack[5] = ((instance->data >> 16) & 0xFF); pack[6] = ((instance->data >> 8) & 0xFF); pack[7] = (instance->data & 0xFF);
|
pack[2] = ((instance->data >> 40) & 0xFF); pack[3] = ((instance->data >> 32) & 0xFF);
|
||||||
|
pack[4] = ((instance->data >> 24) & 0xFF); pack[5] = ((instance->data >> 16) & 0xFF);
|
||||||
|
pack[6] = ((instance->data >> 8) & 0xFF); pack[7] = (instance->data & 0xFF);
|
||||||
atomo_decrypt(pack);
|
atomo_decrypt(pack);
|
||||||
FURI_LOG_I(TAG, "decrypted data: %02X %02X %02X %02X %02X %02X %02X %02X\n", pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
FURI_LOG_I(TAG, "decrypted data: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||||
|
pack[0], pack[1], pack[2], pack[3], pack[4], pack[5], pack[6], pack[7]);
|
||||||
instance->cnt_2 = pack[0];
|
instance->cnt_2 = pack[0];
|
||||||
instance->cnt = (uint16_t)pack[1] << 8 | pack[2];
|
instance->cnt = (uint16_t)pack[1] << 8 | pack[2];
|
||||||
instance->serial = (uint32_t)(pack[3]) << 24 | pack[4] << 16 | pack[5] << 8 | pack[6];
|
instance->serial = (uint32_t)(pack[3]) << 24 | pack[4] << 16 | pack[5] << 8 | pack[6];
|
||||||
|
Loading…
Reference in New Issue
Block a user