mirror of
https://protopirate.net/ProtoPirate/ProtoPirate.git
synced 2026-10-23 09:02:20 +00:00
fix missing define checks and logs removal
This commit is contained in:
16 files changed
+63
-10
No files matched your search
@@ -10,6 +10,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define FIAT_PROTOCOL_V0_NAME "Fiat V0"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderFiatV0 SubGhzProtocolDecoderFiatV0;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <flipper_format/flipper_format.h>
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define FORD_PROTOCOL_V0_NAME "Ford V0"
|
||||
|
||||
extern const SubGhzProtocol ford_protocol_v0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "kia_generic.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V0_NAME "Kia V0"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderKIA SubGhzProtocolDecoderKIA;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "kia_generic.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V1_NAME "Kia V1"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderKiaV1 SubGhzProtocolDecoderKiaV1;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include "protocols_common.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V2_NAME "Kia V2"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderKiaV2 SubGhzProtocolDecoderKiaV2;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "kia_generic.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V3_V4_NAME "Kia V3/V4"
|
||||
|
||||
extern const SubGhzProtocol kia_protocol_v3_v4;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "kia_generic.h"
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V5_NAME "Kia V5"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderKiaV5 SubGhzProtocolDecoderKiaV5;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <flipper_format/flipper_format.h>
|
||||
#include "kia_generic.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define KIA_PROTOCOL_V6_NAME "Kia V6"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderKiaV6 SubGhzProtocolDecoderKiaV6;
|
||||
|
||||
@@ -207,11 +207,15 @@ static void psa_build_buffer_mode23(
|
||||
buffer[8] = (uint8_t)(instance->button & 0xF);
|
||||
|
||||
uint8_t original_buffer9 = 0;
|
||||
#ifndef REMOVE_LOGS
|
||||
uint8_t original_buffer8 = 0;
|
||||
#endif
|
||||
bool has_original_key2 = (instance->key2_low != 0);
|
||||
if(has_original_key2) {
|
||||
original_buffer9 = (uint8_t)(instance->key2_low & 0xFF);
|
||||
#ifndef REMOVE_LOGS
|
||||
original_buffer8 = (uint8_t)((instance->key2_low >> 8) & 0xFF);
|
||||
#endif
|
||||
buffer[9] = original_buffer9;
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define PSA_PROTOCOL_NAME "PSA"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderPSA SubGhzProtocolDecoderPSA;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define SUBGHZ_PROTOCOL_SCHER_KHAN_NAME "Scher-Khan"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderScherKhan SubGhzProtocolDecoderScherKhan;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define SUBGHZ_PROTOCOL_STAR_LINE_NAME "Star Line"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderStarLine SubGhzProtocolDecoderStarLine;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <lib/subghz/blocks/math.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define SUBARU_PROTOCOL_NAME "Subaru"
|
||||
|
||||
extern const SubGhzProtocol subaru_protocol;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <lib/subghz/blocks/math.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define SUZUKI_PROTOCOL_NAME "Suzuki"
|
||||
|
||||
extern const SubGhzProtocol suzuki_protocol;
|
||||
|
||||
+31
-10
@@ -226,8 +226,9 @@ static void vag_parse_data(SubGhzProtocolDecoderVAG* instance) {
|
||||
key1_bytes[6] = (uint8_t)(key1_low >> 8);
|
||||
key1_bytes[7] = (uint8_t)(key1_low);
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
uint8_t type_byte = key1_bytes[0];
|
||||
|
||||
#endif
|
||||
uint8_t block[8];
|
||||
block[0] = key1_bytes[1];
|
||||
block[1] = key1_bytes[2];
|
||||
@@ -1203,7 +1204,9 @@ static void vag_encoder_build_type1(SubGhzProtocolEncoderVAG* instance) {
|
||||
FURI_LOG_D(TAG, "Preamble: %zu pulses (220 cycles + 2 sync)", index);
|
||||
|
||||
uint16_t prefix = 0xAF3F;
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t prefix_start = index;
|
||||
#endif
|
||||
for(int i = 15; i >= 0; i--) {
|
||||
bool bit = (prefix >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1226,7 +1229,9 @@ static void vag_encoder_build_type1(SubGhzProtocolEncoderVAG* instance) {
|
||||
(unsigned long)(key1_inv >> 32),
|
||||
(unsigned long)(key1_inv & 0xFFFFFFFF));
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key1_start = index;
|
||||
#endif
|
||||
for(int i = 63; i >= 0; i--) {
|
||||
bool bit = (key1_inv >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1242,8 +1247,9 @@ static void vag_encoder_build_type1(SubGhzProtocolEncoderVAG* instance) {
|
||||
uint16_t key2 = (uint16_t)(instance->key2_low & 0xFFFF);
|
||||
uint16_t key2_inv = ~key2;
|
||||
FURI_LOG_D(TAG, "Key2: %04X -> inverted: %04X", key2, key2_inv);
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key2_start = index;
|
||||
#endif
|
||||
for(int i = 15; i >= 0; i--) {
|
||||
bool bit = (key2_inv >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1358,7 +1364,9 @@ static void vag_encoder_build_type2(SubGhzProtocolEncoderVAG* instance) {
|
||||
FURI_LOG_D(TAG, "Preamble: %zu pulses (220 cycles + 2 sync)", index);
|
||||
|
||||
uint16_t prefix = 0xAF1C;
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t prefix_start = index;
|
||||
#endif
|
||||
for(int i = 15; i >= 0; i--) {
|
||||
bool bit = (prefix >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1380,8 +1388,9 @@ static void vag_encoder_build_type2(SubGhzProtocolEncoderVAG* instance) {
|
||||
(unsigned long)(key1 & 0xFFFFFFFF),
|
||||
(unsigned long)(key1_inv >> 32),
|
||||
(unsigned long)(key1_inv & 0xFFFFFFFF));
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key1_start = index;
|
||||
#endif
|
||||
for(int i = 63; i >= 0; i--) {
|
||||
bool bit = (key1_inv >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1397,8 +1406,9 @@ static void vag_encoder_build_type2(SubGhzProtocolEncoderVAG* instance) {
|
||||
uint16_t key2 = (uint16_t)(instance->key2_low & 0xFFFF);
|
||||
uint16_t key2_inv = ~key2;
|
||||
FURI_LOG_D(TAG, "Key2: %04X -> inverted: %04X", key2, key2_inv);
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key2_start = index;
|
||||
#endif
|
||||
for(int i = 15; i >= 0; i--) {
|
||||
bool bit = (key2_inv >> i) & 1;
|
||||
if(bit) {
|
||||
@@ -1499,7 +1509,7 @@ static void vag_encoder_build_type3_4(SubGhzProtocolEncoderVAG* instance) {
|
||||
(unsigned long)(key1 >> 32),
|
||||
(unsigned long)(key1 & 0xFFFFFFFF));
|
||||
FURI_LOG_D(TAG, "Key2: %04X (NOT inverted for Type 3/4)", key2);
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
uint8_t key1_byte6 = (key1 >> 8) & 0xFF;
|
||||
uint8_t key1_byte7 = key1 & 0xFF;
|
||||
FURI_LOG_D(
|
||||
@@ -1523,10 +1533,11 @@ static void vag_encoder_build_type3_4(SubGhzProtocolEncoderVAG* instance) {
|
||||
(key1_byte7 >> 2) & 1,
|
||||
(key1_byte7 >> 1) & 1,
|
||||
(key1_byte7 >> 0) & 1);
|
||||
|
||||
#endif
|
||||
for(int repeat = 0; repeat < 2; repeat++) {
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t repeat_start = index;
|
||||
|
||||
#endif
|
||||
for(int i = 0; i < 45; i++) {
|
||||
upload[index++] = level_duration_make(true, 500);
|
||||
upload[index++] = level_duration_make(false, 500);
|
||||
@@ -1541,27 +1552,35 @@ static void vag_encoder_build_type3_4(SubGhzProtocolEncoderVAG* instance) {
|
||||
upload[index++] = level_duration_make(true, 750);
|
||||
upload[index++] = level_duration_make(false, 750);
|
||||
}
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key1_start = index;
|
||||
uint8_t consecutive_same = 0;
|
||||
|
||||
bool prev_level = true;
|
||||
#endif
|
||||
|
||||
for(int i = 63; i >= 0; i--) {
|
||||
bool bit = (key1 >> i) & 1;
|
||||
#ifndef REMOVE_LOGS
|
||||
bool first_level = bit ? true : false;
|
||||
|
||||
if(first_level == prev_level) {
|
||||
consecutive_same++;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(bit) {
|
||||
upload[index++] = level_duration_make(true, 500);
|
||||
upload[index++] = level_duration_make(false, 500);
|
||||
#ifndef REMOVE_LOGS
|
||||
prev_level = false;
|
||||
#endif
|
||||
} else {
|
||||
upload[index++] = level_duration_make(false, 500);
|
||||
upload[index++] = level_duration_make(true, 500);
|
||||
#ifndef REMOVE_LOGS
|
||||
prev_level = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
FURI_LOG_D(
|
||||
@@ -1570,8 +1589,9 @@ static void vag_encoder_build_type3_4(SubGhzProtocolEncoderVAG* instance) {
|
||||
repeat + 1,
|
||||
index - key1_start,
|
||||
consecutive_same);
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
size_t key2_start = index;
|
||||
#endif
|
||||
bool last_level = false;
|
||||
for(int i = 15; i >= 0; i--) {
|
||||
bool bit = (key2 >> i) & 1;
|
||||
@@ -1883,8 +1903,9 @@ SubGhzProtocolStatus
|
||||
"Could not decode original signal - check if keys are loaded and Type is correct");
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef REMOVE_LOGS
|
||||
uint32_t old_cnt = instance->cnt;
|
||||
#endif
|
||||
instance->cnt = (instance->cnt + 1) & 0xFFFFFF;
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define VAG_PROTOCOL_NAME "VAG"
|
||||
|
||||
extern const SubGhzProtocol vag_protocol;
|
||||
|
||||
Reference in new issue
Block a user