mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
merge manually formatted stuff too
This commit is contained in:
@@ -253,5 +253,5 @@ bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask,
|
||||
|
||||
uint8_t reg_val = 0;
|
||||
st25r3916_read_reg(handle, reg, ®_val);
|
||||
return ((reg_val & mask) == val);
|
||||
return (reg_val & mask) == val;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ bool lfrfid_raw_file_write_header(
|
||||
.max_buffer_size = max_buffer_size};
|
||||
|
||||
size_t size = stream_write(file->stream, (uint8_t*)&header, sizeof(LFRFIDRawFileHeader));
|
||||
return (size == sizeof(LFRFIDRawFileHeader));
|
||||
return size == sizeof(LFRFIDRawFileHeader);
|
||||
}
|
||||
|
||||
bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size) {
|
||||
|
||||
@@ -155,7 +155,7 @@ void lfrfid_worker_stop_thread(LFRFIDWorker* worker) {
|
||||
bool lfrfid_worker_check_for_stop(LFRFIDWorker* worker) {
|
||||
UNUSED(worker);
|
||||
uint32_t flags = furi_thread_flags_get();
|
||||
return (flags & LFRFIDEventStopMode);
|
||||
return flags & LFRFIDEventStopMode;
|
||||
}
|
||||
|
||||
size_t lfrfid_worker_dict_get_data_size(LFRFIDWorker* worker, LFRFIDProtocol protocol) {
|
||||
|
||||
@@ -198,7 +198,7 @@ static bool electra_can_be_decoded(
|
||||
parity_sum += (*base_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ static bool electra_can_be_decoded(
|
||||
parity_sum += (*base_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"Unexpected column parity found. EM4100 data: %016llX",
|
||||
|
||||
@@ -173,7 +173,7 @@ static bool em4100_can_be_decoded(
|
||||
parity_sum += (*card_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ static bool em4100_can_be_decoded(
|
||||
parity_sum += (*card_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ static bool protocol_fdx_a_can_be_decoded(const uint8_t* data) {
|
||||
decoded_data[i] &= 0x7F;
|
||||
}
|
||||
|
||||
return (parity_sum == 0);
|
||||
return parity_sum == 0;
|
||||
}
|
||||
|
||||
bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t duration) {
|
||||
|
||||
@@ -71,7 +71,7 @@ static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) {
|
||||
}
|
||||
|
||||
static uint8_t protocol_nexwatch_parity_swap(uint8_t parity) {
|
||||
uint8_t a = (((parity >> 3) & 1));
|
||||
uint8_t a = ((parity >> 3) & 1);
|
||||
a |= (((parity >> 1) & 1) << 1);
|
||||
a |= (((parity >> 2) & 1) << 2);
|
||||
a |= ((parity & 1) << 3);
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
#include "lfrfid_protocols.h"
|
||||
#include <toolbox/manchester_decoder.h>
|
||||
|
||||
#define TAG "SECURAKEY"
|
||||
#define TAG "SECURAKEY"
|
||||
|
||||
#define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BITS (96)
|
||||
#define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BYTE (12)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ bool felica_crc_check(const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = felica_crc_calculate(data, data_size - FELICA_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void felica_crc_trim(BitBuffer* buf) {
|
||||
|
||||
@@ -55,7 +55,7 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso13239_crc_calculate(type, data, data_size - ISO13239_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso13239_crc_trim(BitBuffer* buf) {
|
||||
|
||||
@@ -50,7 +50,7 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso14443_crc_calculate(type, data, data_size - ISO14443_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso14443_crc_trim(BitBuffer* buf) {
|
||||
|
||||
@@ -17,7 +17,7 @@ uint8_t nfc_util_even_parity32(uint32_t data) {
|
||||
// data ^= data >> 16;
|
||||
// data ^= data >> 8;
|
||||
// return !nfc_util_odd_byte_parity[data];
|
||||
return (__builtin_parity(data) & 0xFF);
|
||||
return __builtin_parity(data) & 0xFF;
|
||||
}
|
||||
|
||||
uint8_t nfc_util_odd_parity8(uint8_t data) {
|
||||
|
||||
@@ -39,10 +39,9 @@ static uint32_t felica_wcnt_get_max_value(const FelicaData* data) {
|
||||
|
||||
static bool felica_wcnt_check_warning_boundary(const FelicaData* data) {
|
||||
const uint32_t* wcnt_ptr = (uint32_t*)data->data.fs.wcnt.data;
|
||||
return (
|
||||
FELICA_SYSTEM_BLOCK_RO_ACCESS(data) &&
|
||||
((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) &&
|
||||
(*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE)));
|
||||
return FELICA_SYSTEM_BLOCK_RO_ACCESS(data) &&
|
||||
((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) &&
|
||||
(*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE));
|
||||
}
|
||||
|
||||
static bool felica_wcnt_check_error_boundary(const FelicaData* data) {
|
||||
@@ -138,7 +137,7 @@ static bool felica_listener_check_write_request_data_size(
|
||||
uint8_t possible_data_size = fact_item_cnt * FELICA_DATA_BLOCK_SIZE;
|
||||
uint8_t fact_data_size =
|
||||
request->base.length - sizeof(FelicaListenerGenericRequest) - instance->block_list_size;
|
||||
return (possible_data_size <= fact_data_size);
|
||||
return possible_data_size <= fact_data_size;
|
||||
}
|
||||
|
||||
static bool felica_listener_test_block_list_size_bounds(const FelicaListenerGenericRequest* req) {
|
||||
|
||||
@@ -546,7 +546,7 @@ void mf_classic_set_key_not_found(
|
||||
bool mf_classic_is_block_read(const MfClassicData* data, uint8_t block_num) {
|
||||
furi_check(data);
|
||||
|
||||
return (FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1);
|
||||
return FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1;
|
||||
}
|
||||
|
||||
void mf_classic_set_block_read(MfClassicData* data, uint8_t block_num, MfClassicBlock* block_data) {
|
||||
@@ -661,22 +661,20 @@ static bool mf_classic_is_allowed_access_sector_trailer(
|
||||
}
|
||||
case MfClassicActionKeyAWrite:
|
||||
case MfClassicActionKeyBWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01));
|
||||
}
|
||||
case MfClassicActionKeyBRead: {
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x02 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x02 || AC == 0x01));
|
||||
}
|
||||
case MfClassicActionACRead: {
|
||||
return ((key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB));
|
||||
return (key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB);
|
||||
}
|
||||
case MfClassicActionACWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05));
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
@@ -727,25 +725,21 @@ bool mf_classic_is_allowed_access_data_block(
|
||||
|
||||
switch(action) {
|
||||
case MfClassicActionDataRead: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) ||
|
||||
(key_type == MfClassicKeyTypeB && !(AC == 0x07)));
|
||||
return (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) ||
|
||||
(key_type == MfClassicKeyTypeB && !(AC == 0x07));
|
||||
}
|
||||
case MfClassicActionDataWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03));
|
||||
}
|
||||
case MfClassicActionDataInc: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06));
|
||||
}
|
||||
case MfClassicActionDataDec: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01));
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -197,7 +197,7 @@ static bool mf_plus_poller_detect(NfcGenericEvent event, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
return (error == MfPlusErrorNone);
|
||||
return error == MfPlusErrorNone;
|
||||
}
|
||||
|
||||
const NfcPollerBase mf_plus_poller = {
|
||||
|
||||
@@ -598,7 +598,7 @@ uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) {
|
||||
bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page) {
|
||||
uint8_t pwd_page = mf_ultralight_get_pwd_page_num(type);
|
||||
uint8_t pack_page = pwd_page + 1;
|
||||
return ((pwd_page != 0) && (page == pwd_page || page == pack_page));
|
||||
return (pwd_page != 0) && (page == pwd_page || page == pack_page);
|
||||
}
|
||||
|
||||
bool mf_ultralight_support_feature(const uint32_t feature_set, const uint32_t features_to_check) {
|
||||
|
||||
@@ -125,7 +125,7 @@ static uint8_t mf_ultralight_get_mirror_data_size(MfUltralightMirrorConf mode) {
|
||||
|
||||
static uint8_t mf_ultralight_get_mirror_last_page(MfUltralightListener* instance) {
|
||||
uint8_t strSize = mf_ultralight_get_mirror_data_size(instance->mirror.actual_mode);
|
||||
return (instance->config->mirror_page + 1U + strSize / 4);
|
||||
return instance->config->mirror_page + 1U + strSize / 4;
|
||||
}
|
||||
|
||||
static uint8_t mf_ultralight_get_ascii_offset(uint8_t start_page, MfUltralightListener* instance) {
|
||||
@@ -207,7 +207,7 @@ void mf_ultraligt_mirror_format_counter(MfUltralightListener* instance) {
|
||||
}
|
||||
|
||||
bool mf_ultralight_composite_command_in_progress(MfUltralightListener* instance) {
|
||||
return (instance->composite_cmd.callback != NULL);
|
||||
return instance->composite_cmd.callback != NULL;
|
||||
}
|
||||
|
||||
MfUltralightCommand
|
||||
@@ -550,7 +550,7 @@ static bool mf_ultralight_auth_check_attempts(const MfUltralightListener* instan
|
||||
(1U << instance->config->access.authlim) :
|
||||
instance->config->access.authlim;
|
||||
|
||||
return (instance->data->auth_attempts >= authlim);
|
||||
return instance->data->auth_attempts >= authlim;
|
||||
}
|
||||
|
||||
bool mf_ultralight_auth_limit_check_and_update(MfUltralightListener* instance, bool auth_success) {
|
||||
|
||||
@@ -150,7 +150,7 @@ static inline bool onewire_slave_receive_and_process_command(OneWireSlave* bus)
|
||||
}
|
||||
}
|
||||
|
||||
return (bus->error == OneWireSlaveErrorResetInProgress);
|
||||
return bus->error == OneWireSlaveErrorResetInProgress;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -131,7 +131,7 @@ static uint16_t subghz_protocol_bin_raw_get_full_byte(uint16_t bit_count) {
|
||||
if(bit_count & 0x7) {
|
||||
return (bit_count >> 3) + 1;
|
||||
} else {
|
||||
return (bit_count >> 3);
|
||||
return bit_count >> 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define TAG "SubGhzProtocolCame"
|
||||
#define TAG "SubGhzProtocolCame"
|
||||
|
||||
#define CAME_12_COUNT_BIT 12
|
||||
#define CAME_24_COUNT_BIT 24
|
||||
#define PRASTEL_COUNT_BIT 25
|
||||
@@ -173,7 +174,7 @@ SubGhzProtocolStatus
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
|
||||
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
ret = SubGhzProtocolStatusErrorValueBitCount;
|
||||
break;
|
||||
@@ -336,7 +337,7 @@ SubGhzProtocolStatus
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
|
||||
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
ret = SubGhzProtocolStatusErrorValueBitCount;
|
||||
break;
|
||||
|
||||
@@ -267,13 +267,12 @@ void subghz_protocol_decoder_clemsa_feed(void* context, bool level, uint32_t dur
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_clemsa_const.te_short * 51) <
|
||||
subghz_protocol_clemsa_const.te_delta * 25) {
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
|
||||
subghz_protocol_clemsa_const.te_delta)) {
|
||||
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
|
||||
subghz_protocol_clemsa_const.te_delta) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
|
||||
} else if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
|
||||
subghz_protocol_clemsa_const.te_delta * 3)) {
|
||||
} else if(
|
||||
DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
|
||||
subghz_protocol_clemsa_const.te_delta * 3) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
} else {
|
||||
instance->decoder.parser_step = ClemsaDecoderStepReset;
|
||||
|
||||
@@ -219,8 +219,8 @@ void subghz_protocol_decoder_doitrand_feed(void* context, bool level, uint32_t d
|
||||
}
|
||||
break;
|
||||
case DoitrandDecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
|
||||
subghz_protocol_doitrand_const.te_delta * 3))) {
|
||||
if(level && (DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
|
||||
subghz_protocol_doitrand_const.te_delta * 3)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = DoitrandDecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
||||
@@ -212,8 +212,8 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
|
||||
}
|
||||
break;
|
||||
case GateTXDecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
|
||||
subghz_protocol_gate_tx_const.te_delta * 3))) {
|
||||
if(level && (DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
|
||||
subghz_protocol_gate_tx_const.te_delta * 3)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = GateTXDecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
||||
@@ -358,7 +358,7 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output
|
||||
|
||||
if((instance->generic.btn & 0xF) == 0xE) {
|
||||
furi_string_cat_printf(output, "ON\r\n");
|
||||
} else if(((instance->generic.btn & 0xF) == 0xB)) {
|
||||
} else if((instance->generic.btn & 0xF) == 0xB) {
|
||||
furi_string_cat_printf(output, "OFF\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ static inline bool subghz_protocol_keeloq_check_decrypt_centurion(
|
||||
uint8_t btn) {
|
||||
furi_assert(instance);
|
||||
|
||||
if((decrypt >> 28 == btn) && (((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE))) {
|
||||
if((decrypt >> 28 == btn) && ((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE)) {
|
||||
instance->cnt = decrypt & 0x0000FFFF;
|
||||
/*FURI_LOG_I(
|
||||
"KL",
|
||||
|
||||
@@ -243,8 +243,8 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur
|
||||
if(duration >= (subghz_protocol_linear_const.te_short * 5)) {
|
||||
instance->decoder.parser_step = LinearDecoderStepReset;
|
||||
//checking that the duration matches the guardtime
|
||||
if((DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
|
||||
subghz_protocol_linear_const.te_delta * 20)) {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
|
||||
subghz_protocol_linear_const.te_delta * 20) {
|
||||
break;
|
||||
}
|
||||
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) <
|
||||
|
||||
@@ -269,14 +269,14 @@ void subghz_protocol_decoder_mastercode_feed(void* context, bool level, uint32_t
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_mastercode_const.te_short * 15) <
|
||||
subghz_protocol_mastercode_const.te_delta * 15) {
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
|
||||
subghz_protocol_mastercode_const.te_delta)) {
|
||||
if(DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
|
||||
subghz_protocol_mastercode_const.te_delta) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
|
||||
} else if((DURATION_DIFF(
|
||||
instance->decoder.te_last,
|
||||
subghz_protocol_mastercode_const.te_long) <
|
||||
subghz_protocol_mastercode_const.te_delta * 8)) {
|
||||
} else if(
|
||||
DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_long) <
|
||||
subghz_protocol_mastercode_const.te_delta * 8) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
} else {
|
||||
instance->decoder.parser_step = MastercodeDecoderStepReset;
|
||||
|
||||
@@ -215,8 +215,8 @@ void subghz_protocol_decoder_phoenix_v2_feed(void* context, bool level, uint32_t
|
||||
}
|
||||
break;
|
||||
case Phoenix_V2DecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
|
||||
subghz_protocol_phoenix_v2_const.te_delta * 4))) {
|
||||
if(level && (DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
|
||||
subghz_protocol_phoenix_v2_const.te_delta * 4)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = Phoenix_V2DecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#define TAG "SubGhzProtocolPowerSmart"
|
||||
#define TAG "SubGhzProtocolPowerSmart"
|
||||
|
||||
#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000
|
||||
#define POWER_SMART_PACKET_HEADER_MASK 0xFF000000FF000000
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define TAG "SubGhzProtocolPrinceton"
|
||||
#define TAG "SubGhzProtocolPrinceton"
|
||||
|
||||
#define PRINCETON_GUARD_TIME_DEFALUT 30 //GUARD_TIME = PRINCETON_GUARD_TIME_DEFALUT * TE
|
||||
// Guard Time value should be between 15 -> 72 otherwise default value will be used
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <flipper_format/flipper_format_i.h>
|
||||
#include <lib/toolbox/stream/stream.h>
|
||||
|
||||
#define TAG "SubGhzProtocolRaw"
|
||||
#define TAG "SubGhzProtocolRaw"
|
||||
|
||||
#define SUBGHZ_DOWNLOAD_MAX_SIZE 512
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_raw_const = {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
bool hex_char_to_hex_nibble(char c, uint8_t* nibble) {
|
||||
furi_check(nibble);
|
||||
|
||||
if((c >= '0' && c <= '9')) {
|
||||
if(c >= '0' && c <= '9') {
|
||||
*nibble = c - '0';
|
||||
return true;
|
||||
} else if((c >= 'A' && c <= 'F')) {
|
||||
} else if(c >= 'A' && c <= 'F') {
|
||||
*nibble = c - 'A' + 10;
|
||||
return true;
|
||||
} else if(c >= 'a' && c <= 'f') {
|
||||
|
||||
@@ -68,11 +68,11 @@ static inline LevelDuration level_duration_reset() {
|
||||
}
|
||||
|
||||
static inline bool level_duration_is_reset(LevelDuration level_duration) {
|
||||
return (level_duration == LEVEL_DURATION_RESET);
|
||||
return level_duration == LEVEL_DURATION_RESET;
|
||||
}
|
||||
|
||||
static inline bool level_duration_get_level(LevelDuration level_duration) {
|
||||
return (level_duration > 0);
|
||||
return level_duration > 0;
|
||||
}
|
||||
|
||||
static inline uint32_t level_duration_get_duration(LevelDuration level_duration) {
|
||||
|
||||
@@ -144,7 +144,7 @@ static bool stream_write_struct(Stream* stream, const void* context) {
|
||||
furi_check(stream);
|
||||
furi_check(context);
|
||||
const StreamWriteData* write_data = context;
|
||||
return (stream_write(stream, write_data->data, write_data->size) == write_data->size);
|
||||
return stream_write(stream, write_data->data, write_data->size) == write_data->size;
|
||||
}
|
||||
|
||||
bool stream_read_line(Stream* stream, FuriString* str_result) {
|
||||
|
||||
@@ -51,7 +51,7 @@ static void string_stream_free(StringStream* stream) {
|
||||
}
|
||||
|
||||
static bool string_stream_eof(StringStream* stream) {
|
||||
return (string_stream_tell(stream) >= string_stream_size(stream));
|
||||
return string_stream_tell(stream) >= string_stream_size(stream);
|
||||
}
|
||||
|
||||
static void string_stream_clean(StringStream* stream) {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#include <toolbox/path.h>
|
||||
#include <toolbox/compress.h>
|
||||
|
||||
#define TAG "TarArch"
|
||||
#define TAG "TarArch"
|
||||
|
||||
#define MAX_NAME_LEN 255
|
||||
#define FILE_BLOCK_SIZE 512
|
||||
|
||||
@@ -245,12 +246,12 @@ bool tar_archive_get_read_progress(TarArchive* archive, int32_t* processed, int3
|
||||
|
||||
bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) {
|
||||
furi_check(archive);
|
||||
return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS);
|
||||
return mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_finalize(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_store_data(
|
||||
@@ -260,16 +261,15 @@ bool tar_archive_store_data(
|
||||
const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (
|
||||
tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive));
|
||||
return tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive);
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS);
|
||||
return mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_data_block(
|
||||
@@ -278,12 +278,12 @@ bool tar_archive_file_add_data_block(
|
||||
const int32_t block_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_data(&archive->tar, data_block, block_len) == block_len);
|
||||
return mtar_write_data(&archive->tar, data_block, block_len) == block_len;
|
||||
}
|
||||
|
||||
bool tar_archive_file_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_end_data(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -396,7 +396,7 @@ bool tar_archive_unpack_to(
|
||||
|
||||
FURI_LOG_I(TAG, "Restoring '%s'", destination);
|
||||
|
||||
return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS);
|
||||
return mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_add_file(
|
||||
|
||||
@@ -142,7 +142,7 @@ uint8_t u8x8_d_st756x_common(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* a
|
||||
x *= 8;
|
||||
x += u8x8->x_offset;
|
||||
u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4));
|
||||
u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15)));
|
||||
u8x8_cad_SendCmd(u8x8, 0x000 | (x & 15));
|
||||
u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t*)arg_ptr)->y_pos));
|
||||
|
||||
c = ((u8x8_tile_t*)arg_ptr)->cnt;
|
||||
|
||||
Reference in New Issue
Block a user