diff --git a/applications/system/js_app/js_modules.h b/applications/system/js_app/js_modules.h index 1dfd59521..656a7b7b6 100644 --- a/applications/system/js_app/js_modules.h +++ b/applications/system/js_app/js_modules.h @@ -9,9 +9,10 @@ #define PLUGIN_APP_ID "js" #define PLUGIN_API_VERSION 1 -#define JS_SDK_VENDOR "flipperdevices" -#define JS_SDK_MAJOR 0 -#define JS_SDK_MINOR 1 +#define JS_SDK_VENDOR_FIRMWARE "unleashed" +#define JS_SDK_VENDOR "flipperdevices" +#define JS_SDK_MAJOR 0 +#define JS_SDK_MINOR 1 /** * @brief Returns the foreign pointer in `obj["_"]` diff --git a/applications/system/js_app/modules/js_flipper.c b/applications/system/js_app/modules/js_flipper.c index eeaa2c8a0..228cd0661 100644 --- a/applications/system/js_app/modules/js_flipper.c +++ b/applications/system/js_app/modules/js_flipper.c @@ -37,7 +37,7 @@ void* js_flipper_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) JS_FIELD("getModel", MJS_MK_FN(js_flipper_get_model)); JS_FIELD("getName", MJS_MK_FN(js_flipper_get_name)); JS_FIELD("getBatteryCharge", MJS_MK_FN(js_flipper_get_battery)); - JS_FIELD("firmwareVendor", mjs_mk_string(mjs, JS_SDK_VENDOR, ~0, false)); + JS_FIELD("firmwareVendor", mjs_mk_string(mjs, JS_SDK_VENDOR_FIRMWARE, ~0, false)); JS_FIELD("jsSdkVersion", sdk_vsn); } diff --git a/applications/system/js_app/types/i2c/index.d.ts b/applications/system/js_app/packages/fz-sdk/i2c/index.d.ts similarity index 100% rename from applications/system/js_app/types/i2c/index.d.ts rename to applications/system/js_app/packages/fz-sdk/i2c/index.d.ts diff --git a/applications/system/js_app/types/spi/index.d.ts b/applications/system/js_app/packages/fz-sdk/spi/index.d.ts similarity index 100% rename from applications/system/js_app/types/spi/index.d.ts rename to applications/system/js_app/packages/fz-sdk/spi/index.d.ts diff --git a/lib/subghz/protocols/alutech_at_4n.c b/lib/subghz/protocols/alutech_at_4n.c index b6fb8d290..091a726ed 100644 --- a/lib/subghz/protocols/alutech_at_4n.c +++ b/lib/subghz/protocols/alutech_at_4n.c @@ -308,16 +308,22 @@ bool subghz_protocol_alutech_at_4n_create_data( instance->generic.serial = serial; instance->generic.cnt = cnt; instance->generic.data_count_bit = 72; - bool res = subghz_protocol_alutech_at_4n_gen_data(instance, btn); - if(res) { + if(subghz_protocol_alutech_at_4n_gen_data(instance, btn)) { if((subghz_block_generic_serialize(&instance->generic, flipper_format, preset) != - SubGhzProtocolStatusOk) || - !flipper_format_write_uint32(flipper_format, "CRC", &instance->crc, 1)) { + SubGhzProtocolStatusOk)) { + FURI_LOG_E(TAG, "Serialize error"); + return false; + } + if(!flipper_format_rewind(flipper_format)) { + FURI_LOG_E(TAG, "Rewind error"); + return false; + } + if(!flipper_format_insert_or_update_uint32(flipper_format, "CRC", &instance->crc, 1)) { FURI_LOG_E(TAG, "Unable to add CRC"); - res = false; + return false; } } - return res; + return true; } /** @@ -667,8 +673,12 @@ SubGhzProtocolStatus subghz_protocol_decoder_alutech_at_4n_serialize( SubGhzProtocolDecoderAlutech_at_4n* instance = context; SubGhzProtocolStatus res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset); + if(!flipper_format_rewind(flipper_format)) { + FURI_LOG_E(TAG, "Rewind error"); + res = SubGhzProtocolStatusErrorParserOthers; + } if((res == SubGhzProtocolStatusOk) && - !flipper_format_write_uint32(flipper_format, "CRC", &instance->crc, 1)) { + !flipper_format_insert_or_update_uint32(flipper_format, "CRC", &instance->crc, 1)) { FURI_LOG_E(TAG, "Unable to add CRC"); res = SubGhzProtocolStatusErrorParserOthers; } diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index b1dbb6f86..4d458bc10 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -357,12 +357,12 @@ bool subghz_protocol_keeloq_create_data( instance->generic.cnt = cnt; instance->manufacture_name = manufacture_name; instance->generic.data_count_bit = 64; - bool res = subghz_protocol_keeloq_gen_data(instance, btn, false); - if(res) { - return SubGhzProtocolStatusOk == - subghz_block_generic_serialize(&instance->generic, flipper_format, preset); + if(subghz_protocol_keeloq_gen_data(instance, btn, false)) { + return ( + subghz_block_generic_serialize(&instance->generic, flipper_format, preset) == + SubGhzProtocolStatusOk); } - return res; + return false; } bool subghz_protocol_keeloq_bft_create_data( @@ -382,13 +382,13 @@ bool subghz_protocol_keeloq_bft_create_data( instance->generic.seed = seed; instance->manufacture_name = manufacture_name; instance->generic.data_count_bit = 64; - // roguuemaster don't steal.!!!! - bool res = subghz_protocol_keeloq_gen_data(instance, btn, false); - if(res) { - return SubGhzProtocolStatusOk == - subghz_block_generic_serialize(&instance->generic, flipper_format, preset); + // hehehehe + if(subghz_protocol_keeloq_gen_data(instance, btn, false)) { + return ( + subghz_block_generic_serialize(&instance->generic, flipper_format, preset) == + SubGhzProtocolStatusOk); } - return res; + return false; } /** diff --git a/lib/subghz/protocols/kinggates_stylo_4k.c b/lib/subghz/protocols/kinggates_stylo_4k.c index fc7ca01fd..7e7488f00 100644 --- a/lib/subghz/protocols/kinggates_stylo_4k.c +++ b/lib/subghz/protocols/kinggates_stylo_4k.c @@ -309,7 +309,7 @@ SubGhzProtocolStatus subghz_protocol_encoder_kinggates_stylo_4k_deserialize( key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data_2 >> i * 8) & 0xFF; } if(!flipper_format_update_hex(flipper_format, "Data", key_data, sizeof(uint64_t))) { - FURI_LOG_E(TAG, "Unable to add Key"); + FURI_LOG_E(TAG, "Unable to update Data"); break; } @@ -524,8 +524,13 @@ SubGhzProtocolStatus subghz_protocol_decoder_kinggates_stylo_4k_serialize( key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data_2 >> (i * 8)) & 0xFF; } + if(!flipper_format_rewind(flipper_format)) { + FURI_LOG_E(TAG, "Rewind error"); + ret = SubGhzProtocolStatusErrorParserOthers; + } + if((ret == SubGhzProtocolStatusOk) && - !flipper_format_write_hex(flipper_format, "Data", key_data, sizeof(uint64_t))) { + !flipper_format_insert_or_update_hex(flipper_format, "Data", key_data, sizeof(uint64_t))) { FURI_LOG_E(TAG, "Unable to add Data"); ret = SubGhzProtocolStatusErrorParserOthers; } diff --git a/lib/subghz/protocols/nice_flor_s.c b/lib/subghz/protocols/nice_flor_s.c index 19273e18e..1e5c14c6e 100644 --- a/lib/subghz/protocols/nice_flor_s.c +++ b/lib/subghz/protocols/nice_flor_s.c @@ -271,7 +271,7 @@ SubGhzProtocolStatus key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> i * 8) & 0xFF; } if(!flipper_format_update_hex(flipper_format, "Key", key_data, sizeof(uint64_t))) { - FURI_LOG_E(TAG, "Unable to add Key"); + FURI_LOG_E(TAG, "Unable to update Key"); break; } @@ -282,7 +282,7 @@ SubGhzProtocolStatus } uint32_t temp = (instance->generic.data_2 >> 4) & 0xFFFFF; if(!flipper_format_update_uint32(flipper_format, "Data", &temp, 1)) { - FURI_LOG_E(TAG, "Unable to add Data"); + FURI_LOG_E(TAG, "Unable to update Data"); } } @@ -711,8 +711,13 @@ SubGhzProtocolStatus subghz_protocol_decoder_nice_flor_s_serialize( SubGhzProtocolStatus ret = subghz_block_generic_serialize(&instance->generic, flipper_format, preset); if(instance->generic.data_count_bit == NICE_ONE_COUNT_BIT) { + if(!flipper_format_rewind(flipper_format)) { + FURI_LOG_E(TAG, "Rewind error"); + ret = SubGhzProtocolStatusErrorParserOthers; + } if((ret == SubGhzProtocolStatusOk) && - !flipper_format_write_uint32(flipper_format, "Data", (uint32_t*)&instance->data, 1)) { + !flipper_format_insert_or_update_uint32( + flipper_format, "Data", (uint32_t*)&instance->data, 1)) { FURI_LOG_E(TAG, "Unable to add Data"); ret = SubGhzProtocolStatusErrorParserOthers; }