mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
This commit is contained in:
@@ -46,6 +46,7 @@ enum NfcMagicCustomEvent {
|
||||
struct NfcMagicDevice {
|
||||
MagicType type;
|
||||
uint32_t cuid;
|
||||
uint8_t uid_len;
|
||||
uint32_t password;
|
||||
};
|
||||
|
||||
|
||||
@@ -110,14 +110,7 @@ void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker) {
|
||||
}
|
||||
magic_activate();
|
||||
if(magic_gen1_wupa()) {
|
||||
if(!magic_gen1_data_access_cmd()) {
|
||||
FURI_LOG_E(
|
||||
TAG, "No card response to data access command (not a magic card)");
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
magic_gen1_data_access_cmd();
|
||||
|
||||
MfClassicData* mfc_data = &dev_data->mf_classic_data;
|
||||
for(size_t i = 0; i < 64; i++) {
|
||||
@@ -299,6 +292,7 @@ void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker) {
|
||||
}
|
||||
|
||||
void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker) {
|
||||
FuriHalNfcDevData nfc_data = {};
|
||||
NfcMagicDevice* magic_dev = nfc_magic_worker->magic_dev;
|
||||
bool card_found_notified = false;
|
||||
uint8_t gen4_config[MAGIC_GEN4_CONFIG_LEN];
|
||||
@@ -313,32 +307,44 @@ void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker) {
|
||||
card_found_notified = true;
|
||||
}
|
||||
|
||||
furi_hal_nfc_activate_nfca(200, &magic_dev->cuid);
|
||||
nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context);
|
||||
break;
|
||||
}
|
||||
|
||||
magic_deactivate();
|
||||
furi_delay_ms(300);
|
||||
magic_activate();
|
||||
|
||||
furi_hal_nfc_activate_nfca(200, &magic_dev->cuid);
|
||||
if(magic_gen4_get_cfg(magic_dev->password, gen4_config)) {
|
||||
magic_dev->type = MagicTypeGen4;
|
||||
if(!card_found_notified) {
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventCardDetected, nfc_magic_worker->context);
|
||||
card_found_notified = true;
|
||||
if(furi_hal_nfc_detect(&nfc_data, 200)) {
|
||||
magic_dev->cuid = nfc_data.a_data.cuid;
|
||||
magic_dev->uid_len = nfc_data.uid_len;
|
||||
} else {
|
||||
// wrong BCC
|
||||
magic_dev->uid_len = 4;
|
||||
}
|
||||
|
||||
nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
magic_deactivate();
|
||||
magic_activate();
|
||||
if(furi_hal_nfc_detect(&nfc_data, 200)) {
|
||||
magic_dev->cuid = nfc_data.a_data.cuid;
|
||||
magic_dev->uid_len = nfc_data.uid_len;
|
||||
if(magic_gen4_get_cfg(magic_dev->password, gen4_config)) {
|
||||
magic_dev->type = MagicTypeGen4;
|
||||
if(!card_found_notified) {
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventCardDetected, nfc_magic_worker->context);
|
||||
card_found_notified = true;
|
||||
}
|
||||
|
||||
if(card_found_notified) {
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context);
|
||||
card_found_notified = false;
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventSuccess, nfc_magic_worker->context);
|
||||
} else {
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
|
||||
card_found_notified = true;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if(card_found_notified) {
|
||||
nfc_magic_worker->callback(
|
||||
NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context);
|
||||
card_found_notified = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
magic_deactivate();
|
||||
|
||||
@@ -8,7 +8,7 @@ static bool nfc_magic_scene_file_select_is_file_suitable(NfcMagic* nfc_magic) {
|
||||
case MagicTypeClassicDirectWrite:
|
||||
case MagicTypeClassicAPDU:
|
||||
if((nfc_dev->dev_data.mf_classic_data.type != MfClassicType1k) ||
|
||||
(nfc_dev->dev_data.nfc_data.uid_len != 4)) {
|
||||
(nfc_dev->dev_data.nfc_data.uid_len != nfc_magic->dev->uid_len)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -13,11 +13,10 @@ void nfc_magic_scene_not_magic_on_enter(void* context) {
|
||||
|
||||
notification_message(nfc_magic->notifications, &sequence_error);
|
||||
|
||||
// widget_add_icon_element(widget, 73, 17, &I_DolphinCommon_56x48);
|
||||
widget_add_string_element(
|
||||
widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "This is wrong card");
|
||||
widget_add_string_multiline_element(
|
||||
widget, 4, 17, AlignLeft, AlignTop, FontSecondary, "Not a magic\ncard");
|
||||
widget, 4, 17, AlignLeft, AlignTop, FontSecondary, "Not magic or unsupported\ncard");
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeLeft, "Retry", nfc_magic_scene_not_magic_widget_callback, nfc_magic);
|
||||
|
||||
|
||||
@@ -24,9 +24,10 @@ static const uint32_t subghz_frequency_list[] = {
|
||||
300000000, 302757000, 303875000, 304250000, 307000000, 307500000, 307800000, 309000000,
|
||||
310000000, 312000000, 312100000, 313000000, 313850000, 314000000, 314350000, 314980000,
|
||||
315000000, 318000000, 330000000, 345000000, 348000000, 350000000, 387000000, 390000000,
|
||||
418000000, 433075000, 433220000, 433420000, 433657070, 433889000, 433920000, 434075000,
|
||||
434176948, 434390000, 434420000, 434775000, 438900000, 440175000, 464000000, 779000000,
|
||||
868350000, 868400000, 868800000, 868950000, 906400000, 915000000, 925000000, 928000000};
|
||||
418000000, 430000000, 431000000, 431500000, 433075000, 433220000, 433420000, 433657070,
|
||||
433889000, 433920000, 434075000, 434176948, 434390000, 434420000, 434775000, 438900000,
|
||||
440175000, 464000000, 779000000, 868350000, 868400000, 868800000, 868950000, 906400000,
|
||||
915000000, 925000000, 928000000};
|
||||
|
||||
typedef enum {
|
||||
SubGhzFrequencyAnalyzerStatusIDLE,
|
||||
|
||||
@@ -41,6 +41,9 @@ static const uint32_t subghz_frequency_list[] = {
|
||||
387000000,
|
||||
390000000,
|
||||
418000000,
|
||||
430000000,
|
||||
431000000,
|
||||
431500000,
|
||||
433075000, /* LPD433 first */
|
||||
433220000,
|
||||
433420000,
|
||||
|
||||
Reference in New Issue
Block a user