mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
Merge commit '1907f23e5fbc96ab5cfce6d145169a29d8025e89' into mntm-dev
This commit is contained in:
@@ -140,6 +140,19 @@ static const IdMapping actransit_zones[] = {
|
|||||||
};
|
};
|
||||||
static const size_t kNumACTransitZones = COUNT(actransit_zones);
|
static const size_t kNumACTransitZones = COUNT(actransit_zones);
|
||||||
|
|
||||||
|
// Instead of persisting individual Station IDs, Caltrain saves Zone numbers.
|
||||||
|
// https://www.caltrain.com/stations-zones
|
||||||
|
static const IdMapping caltrain_zones[] = {
|
||||||
|
{.id = 0x0001, .name = "Zone 1"},
|
||||||
|
{.id = 0x0002, .name = "Zone 2"},
|
||||||
|
{.id = 0x0003, .name = "Zone 3"},
|
||||||
|
{.id = 0x0004, .name = "Zone 4"},
|
||||||
|
{.id = 0x0005, .name = "Zone 5"},
|
||||||
|
{.id = 0x0006, .name = "Zone 6"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const size_t kNumCaltrainZones = COUNT(caltrain_zones);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Full agency+zone mapping.
|
// Full agency+zone mapping.
|
||||||
//
|
//
|
||||||
@@ -150,6 +163,7 @@ static const struct {
|
|||||||
} agency_zone_map[] = {
|
} agency_zone_map[] = {
|
||||||
{.agency_id = 0x0001, .zone_map = actransit_zones, .zone_count = kNumACTransitZones},
|
{.agency_id = 0x0001, .zone_map = actransit_zones, .zone_count = kNumACTransitZones},
|
||||||
{.agency_id = 0x0004, .zone_map = bart_zones, .zone_count = kNumBARTZones},
|
{.agency_id = 0x0004, .zone_map = bart_zones, .zone_count = kNumBARTZones},
|
||||||
|
{.agency_id = 0x0006, .zone_map = caltrain_zones, .zone_count = kNumCaltrainZones},
|
||||||
{.agency_id = 0x0012, .zone_map = muni_zones, .zone_count = kNumMUNIZones}};
|
{.agency_id = 0x0012, .zone_map = muni_zones, .zone_count = kNumMUNIZones}};
|
||||||
static const size_t kNumAgencyZoneMaps = COUNT(agency_zone_map);
|
static const size_t kNumAgencyZoneMaps = COUNT(agency_zone_map);
|
||||||
|
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ bool ndef_parse_record(
|
|||||||
NdefTnf tnf,
|
NdefTnf tnf,
|
||||||
const char* type,
|
const char* type,
|
||||||
uint8_t type_len) {
|
uint8_t type_len) {
|
||||||
FURI_LOG_D(TAG, "payload type: %.*s len: %d", type_len, type, len);
|
FURI_LOG_D(TAG, "payload type: %.*s len: %hu", type_len, type, len);
|
||||||
if(!len) {
|
if(!len) {
|
||||||
furi_string_cat(ndef->output, "Empty\n");
|
furi_string_cat(ndef->output, "Empty\n");
|
||||||
return true;
|
return true;
|
||||||
@@ -702,9 +702,9 @@ bool ndef_parse_message(Ndef* ndef, size_t pos, size_t len, size_t message_num,
|
|||||||
pos += id_len;
|
pos += id_len;
|
||||||
|
|
||||||
if(smart_poster) {
|
if(smart_poster) {
|
||||||
furi_string_cat_printf(ndef->output, "\e*> SP-R%d: ", record_num);
|
furi_string_cat_printf(ndef->output, "\e*> SP-R%zu: ", record_num);
|
||||||
} else {
|
} else {
|
||||||
furi_string_cat_printf(ndef->output, "\e*> M%d-R%d: ", message_num, record_num);
|
furi_string_cat_printf(ndef->output, "\e*> M%zu-R%zu: ", message_num, record_num);
|
||||||
}
|
}
|
||||||
if(!ndef_parse_record(ndef, pos, payload_len, flags_tnf.type_name_format, type, type_len)) {
|
if(!ndef_parse_record(ndef, pos, payload_len, flags_tnf.type_name_format, type, type_len)) {
|
||||||
if(type_was_allocated) free(type);
|
if(type_was_allocated) free(type);
|
||||||
@@ -721,7 +721,7 @@ bool ndef_parse_message(Ndef* ndef, size_t pos, size_t len, size_t message_num,
|
|||||||
if(smart_poster) {
|
if(smart_poster) {
|
||||||
furi_string_cat(ndef->output, "\e*> SP: Empty\n\n");
|
furi_string_cat(ndef->output, "\e*> SP: Empty\n\n");
|
||||||
} else {
|
} else {
|
||||||
furi_string_cat_printf(ndef->output, "\e*> M%d: Empty\n\n", message_num);
|
furi_string_cat_printf(ndef->output, "\e*> M%zu: Empty\n\n", message_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,7 +949,7 @@ static bool ndef_mfc_parse(const NfcDevice* device, FuriString* parsed_data) {
|
|||||||
} else {
|
} else {
|
||||||
data_block = 93 + (sector - 32) * 15;
|
data_block = 93 + (sector - 32) * 15;
|
||||||
}
|
}
|
||||||
FURI_LOG_D(TAG, "data_block: %d", data_block);
|
FURI_LOG_D(TAG, "data_block: %zu", data_block);
|
||||||
size_t data_start = data_block * MF_CLASSIC_BLOCK_SIZE;
|
size_t data_start = data_block * MF_CLASSIC_BLOCK_SIZE;
|
||||||
size_t parsed = ndef_parse_tlv(&ndef, data_start, data_size - data_start, total_parsed);
|
size_t parsed = ndef_parse_tlv(&ndef, data_start, data_size - data_start, total_parsed);
|
||||||
|
|
||||||
@@ -982,7 +982,7 @@ static bool ndef_slix_parse(const NfcDevice* device, FuriString* parsed_data) {
|
|||||||
const uint16_t block_count = iso15693_3_get_block_count(data);
|
const uint16_t block_count = iso15693_3_get_block_count(data);
|
||||||
const uint8_t* blocks = simple_array_cget_data(data->block_data);
|
const uint8_t* blocks = simple_array_cget_data(data->block_data);
|
||||||
|
|
||||||
// TODO: Find some way to check for other iso15693 NDEF cards and
|
// TODO(-nofl): Find some way to check for other iso15693 NDEF cards and
|
||||||
// split this to also support non-slix iso15693 NDEF tags
|
// split this to also support non-slix iso15693 NDEF tags
|
||||||
// Rest of the code works on iso15693 too, but uses SLIX layout assumptions
|
// Rest of the code works on iso15693 too, but uses SLIX layout assumptions
|
||||||
if(block_size != SLIX_BLOCK_SIZE) {
|
if(block_size != SLIX_BLOCK_SIZE) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ To run the unit tests, follow these steps:
|
|||||||
3. Launch the CLI session and run the `unit_tests` command.
|
3. Launch the CLI session and run the `unit_tests` command.
|
||||||
|
|
||||||
**NOTE:** To run a particular test (and skip all others), specify its name as the command argument.
|
**NOTE:** To run a particular test (and skip all others), specify its name as the command argument.
|
||||||
See [test_index.c](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/applications/debug/unit_tests/test_index.c) for the complete list of test names.
|
Test names match application names defined [here](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/applications/debug/unit_tests/application.fam).
|
||||||
|
|
||||||
## Adding unit tests
|
## Adding unit tests
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ See [test_index.c](https://github.com/flipperdevices/flipperzero-firmware/blob/d
|
|||||||
|
|
||||||
#### Entry point
|
#### Entry point
|
||||||
|
|
||||||
The common entry point for all tests is the [unit_tests](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/debug/unit_tests) app. Test-specific code is placed into an arbitrarily named subdirectory and is then called from the [test_index.c](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/debug/unit_tests/test_index.c) source file.
|
The common entry point for all tests is the [unit_tests](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/debug/unit_tests) app. Test-specific code is packaged as a `PLUGIN` app placed in a subdirectory of `tests` in the `unit_tests` mother-app and referenced in the common `application.fam`. Look at other tests for an example.
|
||||||
|
|
||||||
#### Test assets
|
#### Test assets
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user