updated protoview

This commit is contained in:
jbohack
2023-01-15 22:54:39 -05:00
parent 35befd07c4
commit debd850ccd
30 changed files with 1046 additions and 955 deletions

View File

@@ -9,9 +9,9 @@
#include "../app.h"
static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) {
if(numbits < 30) return false;
const char* sync_patterns[3] = {
static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) {
if (numbits < 30) return false;
const char *sync_patterns[3] = {
"10000000000000000000000000000001", /* 30 zero bits. */
"100000000000000000000000000000001", /* 31 zero bits. */
"1000000000000000000000000000000001", /* 32 zero bits. */
@@ -19,23 +19,26 @@ static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoView
uint32_t off;
int j;
for(j = 0; j < 3; j++) {
off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_patterns[j]);
if(off != BITMAP_SEEK_NOT_FOUND) break;
for (j = 0; j < 3; j++) {
off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_patterns[j]);
if (off != BITMAP_SEEK_NOT_FOUND) break;
}
if(off == BITMAP_SEEK_NOT_FOUND) return false;
if(DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 preamble at: %lu", off);
off += strlen(sync_patterns[j]) - 1;
if (off == BITMAP_SEEK_NOT_FOUND) return false;
if (DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 preamble at: %lu",off);
off += strlen(sync_patterns[j])-1;
uint8_t d[3]; /* 24 bits of data. */
uint32_t decoded = convert_from_line_code(d, sizeof(d), bits, numbytes, off, "1000", "1110");
uint32_t decoded =
convert_from_line_code(d,sizeof(d),bits,numbytes,off,"1000","1110");
if(DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 decoded: %lu", decoded);
if(decoded != 24) return false;
snprintf(info->name, PROTOVIEW_MSG_STR_LEN, "PT/SC remote");
snprintf(info->raw, PROTOVIEW_MSG_STR_LEN, "%02X%02X%02X", d[0], d[1], d[2]);
info->len = off + (4 * 24);
if (DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 decoded: %lu",decoded);
if (decoded != 24) return false;
snprintf(info->name,PROTOVIEW_MSG_STR_LEN,"PT/SC remote");
snprintf(info->raw,PROTOVIEW_MSG_STR_LEN,"%02X%02X%02X",d[0],d[1],d[2]);
info->len = off+(4*24);
return true;
}
ProtoViewDecoder B4B1Decoder = {"B4B1", decode};
ProtoViewDecoder B4B1Decoder = {
"B4B1", decode
};