This commit is contained in:
Willy-JL
2023-06-09 13:54:14 +01:00
66 changed files with 527 additions and 142 deletions
+2 -2
View File
@@ -414,7 +414,7 @@ int32_t hid_usb_app(void* p) {
bt_hid_connection_status_changed_callback(BtStatusConnected, app);
DOLPHIN_DEED(DolphinDeedPluginStart);
dolphin_deed(DolphinDeedPluginStart);
view_dispatcher_run(app->view_dispatcher);
@@ -454,7 +454,7 @@ int32_t hid_ble_app(void* p) {
furi_hal_bt_start_advertising();
bt_set_status_changed_callback(app->bt, bt_hid_connection_status_changed_callback, app);
DOLPHIN_DEED(DolphinDeedPluginStart);
dolphin_deed(DolphinDeedPluginStart);
view_dispatcher_run(app->view_dispatcher);
+1 -1
View File
@@ -1112,7 +1112,7 @@ void mfkey32(ProgramState* program_state) {
}
if(keyarray_size > 0) {
// TODO: Should we use DolphinDeedNfcMfcAdd?
DOLPHIN_DEED(DolphinDeedNfcMfcAdd);
dolphin_deed(DolphinDeedNfcMfcAdd);
}
napi_mf_classic_nonce_array_free(nonce_arr);
napi_mf_classic_dict_free(user_dict);
@@ -19,7 +19,7 @@ void picopass_scene_device_info_on_enter(void* context) {
FuriString* wiegand_str = furi_string_alloc();
FuriString* sio_str = furi_string_alloc();
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
// Setup view
PicopassBlock* AA1 = picopass->dev->dev_data.AA1;
@@ -10,7 +10,7 @@ void picopass_read_card_worker_callback(PicopassWorkerEvent event, void* context
void picopass_scene_read_card_on_enter(void* context) {
Picopass* picopass = context;
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
// Setup view
Popup* popup = picopass->popup;
@@ -21,7 +21,7 @@ void picopass_scene_read_card_success_on_enter(void* context) {
FuriString* wiegand_str = furi_string_alloc();
FuriString* sio_str = furi_string_alloc();
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
// Send notification
notification_message(picopass->notifications, &sequence_success);
@@ -19,7 +19,7 @@ void picopass_scene_read_factory_success_on_enter(void* context) {
FuriString* title = furi_string_alloc_set("Factory Default");
FuriString* subtitle = furi_string_alloc_set("");
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
// Send notification
notification_message(picopass->notifications, &sequence_success);
@@ -8,7 +8,7 @@ void picopass_scene_save_success_popup_callback(void* context) {
void picopass_scene_save_success_on_enter(void* context) {
Picopass* picopass = context;
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
// Setup view
Popup* popup = picopass->popup;
@@ -9,7 +9,7 @@ void picopass_write_card_worker_callback(PicopassWorkerEvent event, void* contex
void picopass_scene_write_card_on_enter(void* context) {
Picopass* picopass = context;
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
// Setup view
Popup* popup = picopass->popup;
@@ -18,7 +18,7 @@ void picopass_scene_write_card_success_on_enter(void* context) {
Widget* widget = picopass->widget;
FuriString* str = furi_string_alloc_set("Write Success!");
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
// Send notification
notification_message(picopass->notifications, &sequence_success);
@@ -9,7 +9,7 @@ void picopass_write_key_worker_callback(PicopassWorkerEvent event, void* context
void picopass_scene_write_key_on_enter(void* context) {
Picopass* picopass = context;
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
// Setup view
Popup* popup = picopass->popup;
@@ -0,0 +1,365 @@
#include "oregon3.h"
#include <lib/subghz/blocks/const.h>
#include <lib/subghz/blocks/decoder.h>
#include <lib/subghz/blocks/encoder.h>
#include <lib/subghz/blocks/math.h>
#include "ws_generic.h"
#include <lib/toolbox/manchester_decoder.h>
#include <lib/flipper_format/flipper_format_i.h>
#define TAG "WSProtocolOregon3"
static const SubGhzBlockConst ws_oregon3_const = {
.te_long = 1100,
.te_short = 500,
.te_delta = 300,
.min_count_bit_for_found = 32,
};
#define OREGON3_PREAMBLE_BITS 28
#define OREGON3_PREAMBLE_MASK 0b1111111111111111111111111111
// 24 ones + 0101 (inverted A)
#define OREGON3_PREAMBLE 0b1111111111111111111111110101
// Fixed part contains:
// - Sensor type: 16 bits
// - Channel: 4 bits
// - ID (changes when batteries are changed): 8 bits
// - Battery status: 4 bits
#define OREGON3_FIXED_PART_BITS (16 + 4 + 8 + 4)
#define OREGON3_SENSOR_ID(d) (((d) >> 16) & 0xFFFF)
#define OREGON3_CHECKSUM_BITS 8
// bit indicating the low battery
#define OREGON3_FLAG_BAT_LOW 0x4
/// Documentation for Oregon Scientific protocols can be found here:
/// https://www.osengr.org/Articles/OS-RF-Protocols-IV.pdf
// Sensors ID
#define ID_THGR221 0xf824
struct WSProtocolDecoderOregon3 {
SubGhzProtocolDecoderBase base;
SubGhzBlockDecoder decoder;
WSBlockGeneric generic;
ManchesterState manchester_state;
bool prev_bit;
uint8_t var_bits;
uint64_t var_data;
};
typedef struct WSProtocolDecoderOregon3 WSProtocolDecoderOregon3;
typedef enum {
Oregon3DecoderStepReset = 0,
Oregon3DecoderStepFoundPreamble,
Oregon3DecoderStepVarData,
} Oregon3DecoderStep;
void* ws_protocol_decoder_oregon3_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
WSProtocolDecoderOregon3* instance = malloc(sizeof(WSProtocolDecoderOregon3));
instance->base.protocol = &ws_protocol_oregon3;
instance->generic.protocol_name = instance->base.protocol->name;
instance->generic.humidity = WS_NO_HUMIDITY;
instance->generic.temp = WS_NO_TEMPERATURE;
instance->generic.btn = WS_NO_BTN;
instance->generic.channel = WS_NO_CHANNEL;
instance->generic.battery_low = WS_NO_BATT;
instance->generic.id = WS_NO_ID;
instance->prev_bit = false;
return instance;
}
void ws_protocol_decoder_oregon3_free(void* context) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
free(instance);
}
void ws_protocol_decoder_oregon3_reset(void* context) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
instance->decoder.parser_step = Oregon3DecoderStepReset;
instance->decoder.decode_data = 0UL;
instance->decoder.decode_count_bit = 0;
manchester_advance(
instance->manchester_state, ManchesterEventReset, &instance->manchester_state, NULL);
instance->prev_bit = false;
instance->var_data = 0;
instance->var_bits = 0;
}
static ManchesterEvent level_and_duration_to_event(bool level, uint32_t duration) {
bool is_long = false;
if(DURATION_DIFF(duration, ws_oregon3_const.te_long) < ws_oregon3_const.te_delta) {
is_long = true;
} else if(DURATION_DIFF(duration, ws_oregon3_const.te_short) < ws_oregon3_const.te_delta) {
is_long = false;
} else {
return ManchesterEventReset;
}
if(level)
return is_long ? ManchesterEventLongHigh : ManchesterEventShortHigh;
else
return is_long ? ManchesterEventLongLow : ManchesterEventShortLow;
}
// From sensor id code return amount of bits in variable section
// https://temofeev.ru/info/articles/o-dekodirovanii-protokola-pogodnykh-datchikov-oregon-scientific
static uint8_t oregon3_sensor_id_var_bits(uint16_t sensor_id) {
switch(sensor_id) {
case ID_THGR221:
default:
// nibbles: temp + hum + '0'
return (4 + 2 + 1) * 4;
}
}
static void ws_oregon3_decode_const_data(WSBlockGeneric* ws_block) {
ws_block->id = OREGON3_SENSOR_ID(ws_block->data);
ws_block->channel = (ws_block->data >> 12) & 0xF;
ws_block->battery_low = (ws_block->data & OREGON3_FLAG_BAT_LOW) ? 1 : 0;
}
static uint16_t ws_oregon3_bcd_decode_short(uint32_t data) {
return (data & 0xF) * 10 + ((data >> 4) & 0xF);
}
static float ws_oregon3_decode_temp(uint32_t data) {
int32_t temp_val;
temp_val = ws_oregon3_bcd_decode_short(data >> 4);
temp_val *= 10;
temp_val += (data >> 12) & 0xF;
if(data & 0xF) temp_val = -temp_val;
return (float)temp_val / 10.0;
}
static void ws_oregon3_decode_var_data(WSBlockGeneric* ws_b, uint16_t sensor_id, uint32_t data) {
switch(sensor_id) {
case ID_THGR221:
default:
ws_b->humidity = ws_oregon3_bcd_decode_short(data >> 4);
ws_b->temp = ws_oregon3_decode_temp(data >> 12);
break;
}
}
void ws_protocol_decoder_oregon3_feed(void* context, bool level, uint32_t duration) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
// Oregon v3.0 protocol is inverted
ManchesterEvent event = level_and_duration_to_event(!level, duration);
// low-level bit sequence decoding
if(event == ManchesterEventReset) {
instance->decoder.parser_step = Oregon3DecoderStepReset;
instance->prev_bit = false;
instance->decoder.decode_data = 0UL;
instance->decoder.decode_count_bit = 0;
}
if(manchester_advance(
instance->manchester_state, event, &instance->manchester_state, &instance->prev_bit)) {
subghz_protocol_blocks_add_bit(&instance->decoder, instance->prev_bit);
}
switch(instance->decoder.parser_step) {
case Oregon3DecoderStepReset:
// waiting for fixed oregon3 preamble
if(instance->decoder.decode_count_bit >= OREGON3_PREAMBLE_BITS &&
((instance->decoder.decode_data & OREGON3_PREAMBLE_MASK) == OREGON3_PREAMBLE)) {
instance->decoder.parser_step = Oregon3DecoderStepFoundPreamble;
instance->decoder.decode_count_bit = 0;
instance->decoder.decode_data = 0UL;
}
break;
case Oregon3DecoderStepFoundPreamble:
// waiting for fixed oregon3 data
if(instance->decoder.decode_count_bit == OREGON3_FIXED_PART_BITS) {
instance->generic.data = instance->decoder.decode_data;
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
instance->decoder.decode_data = 0UL;
instance->decoder.decode_count_bit = 0;
// reverse nibbles in decoded data as oregon v3.0 is LSB first
instance->generic.data = (instance->generic.data & 0x55555555) << 1 |
(instance->generic.data & 0xAAAAAAAA) >> 1;
instance->generic.data = (instance->generic.data & 0x33333333) << 2 |
(instance->generic.data & 0xCCCCCCCC) >> 2;
ws_oregon3_decode_const_data(&instance->generic);
instance->var_bits =
oregon3_sensor_id_var_bits(OREGON3_SENSOR_ID(instance->generic.data));
if(!instance->var_bits) {
// sensor is not supported, stop decoding, but showing the decoded fixed part
instance->decoder.parser_step = Oregon3DecoderStepReset;
if(instance->base.callback)
instance->base.callback(&instance->base, instance->base.context);
} else {
instance->decoder.parser_step = Oregon3DecoderStepVarData;
}
}
break;
case Oregon3DecoderStepVarData:
// waiting for variable (sensor-specific data)
if(instance->decoder.decode_count_bit == instance->var_bits + OREGON3_CHECKSUM_BITS) {
instance->var_data = instance->decoder.decode_data & 0xFFFFFFFFFFFFFFFF;
// reverse nibbles in var data
instance->var_data = (instance->var_data & 0x5555555555555555) << 1 |
(instance->var_data & 0xAAAAAAAAAAAAAAAA) >> 1;
instance->var_data = (instance->var_data & 0x3333333333333333) << 2 |
(instance->var_data & 0xCCCCCCCCCCCCCCCC) >> 2;
ws_oregon3_decode_var_data(
&instance->generic,
OREGON3_SENSOR_ID(instance->generic.data),
instance->var_data >> OREGON3_CHECKSUM_BITS);
instance->decoder.parser_step = Oregon3DecoderStepReset;
if(instance->base.callback)
instance->base.callback(&instance->base, instance->base.context);
}
break;
}
}
uint8_t ws_protocol_decoder_oregon3_get_hash_data(void* context) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
return subghz_protocol_blocks_get_hash_data(
&instance->decoder, (instance->decoder.decode_count_bit / 8) + 1);
}
SubGhzProtocolStatus ws_protocol_decoder_oregon3_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
ret = ws_block_generic_serialize(&instance->generic, flipper_format, preset);
if(ret != SubGhzProtocolStatusOk) return ret;
uint32_t temp = instance->var_bits;
if(!flipper_format_write_uint32(flipper_format, "VarBits", &temp, 1)) {
FURI_LOG_E(TAG, "Error adding VarBits");
return SubGhzProtocolStatusErrorParserOthers;
}
if(!flipper_format_write_hex(
flipper_format,
"VarData",
(const uint8_t*)&instance->var_data,
sizeof(instance->var_data))) {
FURI_LOG_E(TAG, "Error adding VarData");
return SubGhzProtocolStatusErrorParserOthers;
}
return ret;
}
SubGhzProtocolStatus
ws_protocol_decoder_oregon3_deserialize(void* context, FlipperFormat* flipper_format) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
uint32_t temp_data;
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
do {
ret = ws_block_generic_deserialize(&instance->generic, flipper_format);
if(ret != SubGhzProtocolStatusOk) {
break;
}
if(!flipper_format_read_uint32(flipper_format, "VarBits", &temp_data, 1)) {
FURI_LOG_E(TAG, "Missing VarLen");
ret = SubGhzProtocolStatusErrorParserOthers;
break;
}
instance->var_bits = (uint8_t)temp_data;
if(!flipper_format_read_hex(
flipper_format,
"VarData",
(uint8_t*)&instance->var_data,
sizeof(instance->var_data))) { //-V1051
FURI_LOG_E(TAG, "Missing VarData");
ret = SubGhzProtocolStatusErrorParserOthers;
break;
}
if(instance->generic.data_count_bit != ws_oregon3_const.min_count_bit_for_found) {
FURI_LOG_E(TAG, "Wrong number of bits in key: %d", instance->generic.data_count_bit);
ret = SubGhzProtocolStatusErrorValueBitCount;
break;
}
} while(false);
return ret;
}
static void oregon3_append_check_sum(uint32_t fix_data, uint64_t var_data, FuriString* output) {
uint8_t sum = fix_data & 0xF;
uint8_t ref_sum = var_data & 0xFF;
var_data >>= 4;
for(uint8_t i = 1; i < 8; i++) {
fix_data >>= 4;
var_data >>= 4;
sum += (fix_data & 0xF) + (var_data & 0xF);
}
// swap calculated sum nibbles
sum = (((sum >> 4) & 0xF) | (sum << 4)) & 0xFF;
if(sum == ref_sum)
furi_string_cat_printf(output, "Sum ok: 0x%hhX", ref_sum);
else
furi_string_cat_printf(output, "Sum err: 0x%hhX vs 0x%hhX", ref_sum, sum);
}
void ws_protocol_decoder_oregon3_get_string(void* context, FuriString* output) {
furi_assert(context);
WSProtocolDecoderOregon3* instance = context;
furi_string_cat_printf(
output,
"%s\r\n"
"ID: 0x%04lX, ch: %d, bat: %d, rc: 0x%02lX\r\n",
instance->generic.protocol_name,
instance->generic.id,
instance->generic.channel,
instance->generic.battery_low,
(uint32_t)(instance->generic.data >> 4) & 0xFF);
if(instance->var_bits > 0) {
furi_string_cat_printf(
output,
"Temp:%d.%d C Hum:%d%%",
(int16_t)instance->generic.temp,
abs(
((int16_t)(instance->generic.temp * 10) -
(((int16_t)instance->generic.temp) * 10))),
instance->generic.humidity);
oregon3_append_check_sum((uint32_t)instance->generic.data, instance->var_data, output);
}
}
const SubGhzProtocolDecoder ws_protocol_oregon3_decoder = {
.alloc = ws_protocol_decoder_oregon3_alloc,
.free = ws_protocol_decoder_oregon3_free,
.feed = ws_protocol_decoder_oregon3_feed,
.reset = ws_protocol_decoder_oregon3_reset,
.get_hash_data = ws_protocol_decoder_oregon3_get_hash_data,
.serialize = ws_protocol_decoder_oregon3_serialize,
.deserialize = ws_protocol_decoder_oregon3_deserialize,
.get_string = ws_protocol_decoder_oregon3_get_string,
};
const SubGhzProtocol ws_protocol_oregon3 = {
.name = WS_PROTOCOL_OREGON3_NAME,
.type = SubGhzProtocolWeatherStation,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable,
.decoder = &ws_protocol_oregon3_decoder,
};
@@ -0,0 +1,6 @@
#pragma once
#include <lib/subghz/protocols/base.h>
#define WS_PROTOCOL_OREGON3_NAME "Oregon3"
extern const SubGhzProtocol ws_protocol_oregon3;
@@ -11,6 +11,7 @@ const SubGhzProtocol* weather_station_protocol_registry_items[] = {
&ws_protocol_lacrosse_tx,
&ws_protocol_lacrosse_tx141thbv2,
&ws_protocol_oregon2,
&ws_protocol_oregon3,
&ws_protocol_acurite_592txr,
&ws_protocol_ambient_weather,
&ws_protocol_auriol_th,
@@ -21,4 +22,4 @@ const SubGhzProtocol* weather_station_protocol_registry_items[] = {
const SubGhzProtocolRegistry weather_station_protocol_registry = {
.items = weather_station_protocol_registry_items,
.size = COUNT_OF(weather_station_protocol_registry_items)};
.size = COUNT_OF(weather_station_protocol_registry_items)};
@@ -11,6 +11,7 @@
#include "lacrosse_tx.h"
#include "lacrosse_tx141thbv2.h"
#include "oregon2.h"
#include "oregon3.h"
#include "acurite_592txr.h"
#include "ambient_weather.h"
#include "auriol_hg0601a.h"
@@ -107,7 +107,7 @@ bool gpio_scene_start_on_event(void* context, SceneManagerEvent event) {
} else if(event.event == GpioStartEventUsbUart) {
scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemUsbUart);
if(!furi_hal_usb_is_locked()) {
DOLPHIN_DEED(DolphinDeedGpioUartBridge);
dolphin_deed(DolphinDeedGpioUartBridge);
scene_manager_next_scene(app->scene_manager, GpioSceneUsbUart);
} else {
scene_manager_next_scene(app->scene_manager, GpioSceneUsbUartCloseRpc);
+2 -2
View File
@@ -284,14 +284,14 @@ int32_t ibutton_app(char* arg) {
view_dispatcher_attach_to_gui(
ibutton->view_dispatcher, ibutton->gui, ViewDispatcherTypeDesktop);
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneRpc);
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);
dolphin_deed(DolphinDeedIbuttonEmulate);
} else {
view_dispatcher_attach_to_gui(
ibutton->view_dispatcher, ibutton->gui, ViewDispatcherTypeFullscreen);
if(key_loaded) { //-V547
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneEmulate);
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);
dolphin_deed(DolphinDeedIbuttonEmulate);
} else {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneStart);
}
@@ -38,7 +38,7 @@ bool ibutton_scene_read_on_event(void* context, SceneManagerEvent event) {
ibutton_notification_message(ibutton, iButtonNotificationMessageSuccess);
scene_manager_next_scene(scene_manager, iButtonSceneReadSuccess);
DOLPHIN_DEED(DolphinDeedIbuttonReadSuccess);
dolphin_deed(DolphinDeedIbuttonReadSuccess);
} else {
scene_manager_next_scene(scene_manager, iButtonSceneReadError);
@@ -75,7 +75,7 @@ bool ibutton_scene_read_key_menu_on_event(void* context, SceneManagerEvent event
scene_manager_next_scene(scene_manager, iButtonSceneSaveName);
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(scene_manager, iButtonSceneEmulate);
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);
dolphin_deed(DolphinDeedIbuttonEmulate);
} else if(event.event == SubmenuIndexViewData) {
scene_manager_next_scene(scene_manager, iButtonSceneViewData);
} else if(event.event == SubmenuIndexWriteBlank) {
@@ -58,9 +58,9 @@ bool ibutton_scene_save_name_on_event(void* context, SceneManagerEvent event) {
// Nothing, do not count editing as saving
} else if(scene_manager_has_previous_scene(
ibutton->scene_manager, iButtonSceneAddType)) {
DOLPHIN_DEED(DolphinDeedIbuttonAdd);
dolphin_deed(DolphinDeedIbuttonAdd);
} else {
DOLPHIN_DEED(DolphinDeedIbuttonSave);
dolphin_deed(DolphinDeedIbuttonSave);
}
} else {
@@ -48,7 +48,7 @@ bool ibutton_scene_saved_key_menu_on_event(void* context, SceneManagerEvent even
consumed = true;
if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(scene_manager, iButtonSceneEmulate);
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);
dolphin_deed(DolphinDeedIbuttonEmulate);
} else if(event.event == SubmenuIndexWriteBlank) {
ibutton->write_mode = iButtonWriteModeBlank;
scene_manager_next_scene(scene_manager, iButtonSceneWrite);
@@ -33,7 +33,7 @@ bool ibutton_scene_start_on_event(void* context, SceneManagerEvent event) {
consumed = true;
if(event.event == SubmenuIndexRead) {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneRead);
DOLPHIN_DEED(DolphinDeedIbuttonRead);
dolphin_deed(DolphinDeedIbuttonRead);
} else if(event.event == SubmenuIndexSaved) {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneSelectKey);
} else if(event.event == SubmenuIndexAdd) {
+1 -1
View File
@@ -334,7 +334,7 @@ void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
infrared_worker_set_decoded_signal(infrared->worker, message);
}
DOLPHIN_DEED(DolphinDeedIrSend);
dolphin_deed(DolphinDeedIrSend);
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
infrared_worker_tx_set_get_signal_callback(
@@ -70,7 +70,7 @@ bool infrared_scene_universal_common_on_event(void* context, SceneManagerEvent e
uint32_t record_count;
if(infrared_brute_force_start(
brute_force, infrared_custom_event_get_value(event.event), &record_count)) {
DOLPHIN_DEED(DolphinDeedIrSend);
dolphin_deed(DolphinDeedIrSend);
infrared_scene_universal_common_show_popup(infrared, record_count);
} else {
scene_manager_next_scene(scene_manager, InfraredSceneErrorDatabases);
@@ -28,7 +28,7 @@ bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {
if(event.event == InfraredCustomEventTypeSignalReceived) {
infrared_play_notification_message(infrared, InfraredNotificationMessageSuccess);
scene_manager_next_scene(infrared->scene_manager, InfraredSceneLearnSuccess);
DOLPHIN_DEED(DolphinDeedIrLearnSuccess);
dolphin_deed(DolphinDeedIrLearnSuccess);
consumed = true;
}
}
@@ -50,7 +50,7 @@ bool infrared_scene_learn_enter_name_on_event(void* context, SceneManagerEvent e
if(success) {
scene_manager_next_scene(scene_manager, InfraredSceneLearnDone);
DOLPHIN_DEED(DolphinDeedIrSave);
dolphin_deed(DolphinDeedIrSave);
} else {
dialog_message_show_storage_error(infrared->dialogs, "Failed to save file");
const uint32_t possible_scenes[] = {InfraredSceneRemoteList, InfraredSceneStart};
+2 -2
View File
@@ -184,14 +184,14 @@ int32_t lfrfid_app(char* args) {
view_dispatcher_attach_to_gui(
app->view_dispatcher, app->gui, ViewDispatcherTypeDesktop);
scene_manager_next_scene(app->scene_manager, LfRfidSceneRpc);
DOLPHIN_DEED(DolphinDeedRfidEmulate);
dolphin_deed(DolphinDeedRfidEmulate);
} else {
furi_string_set(app->file_path, args);
if(lfrfid_load_key_data(app, app->file_path, true)) {
view_dispatcher_attach_to_gui(
app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
scene_manager_next_scene(app->scene_manager, LfRfidSceneEmulate);
DOLPHIN_DEED(DolphinDeedRfidEmulate);
dolphin_deed(DolphinDeedRfidEmulate);
} else {
// TODO: exit properly
lfrfid_free(app);
@@ -74,12 +74,12 @@ bool lfrfid_scene_extra_actions_on_event(void* context, SceneManagerEvent event)
if(event.event == SubmenuIndexASK) {
app->read_type = LFRFIDWorkerReadTypeASKOnly;
scene_manager_next_scene(app->scene_manager, LfRfidSceneRead);
DOLPHIN_DEED(DolphinDeedRfidRead);
dolphin_deed(DolphinDeedRfidRead);
consumed = true;
} else if(event.event == SubmenuIndexPSK) {
app->read_type = LFRFIDWorkerReadTypePSKOnly;
scene_manager_next_scene(app->scene_manager, LfRfidSceneRead);
DOLPHIN_DEED(DolphinDeedRfidRead);
dolphin_deed(DolphinDeedRfidRead);
consumed = true;
} else if(event.event == SubmenuIndexClearT5577) {
scene_manager_next_scene(app->scene_manager, LfRfidSceneClearT5577Confirm);
@@ -81,7 +81,7 @@ bool lfrfid_scene_read_on_event(void* context, SceneManagerEvent event) {
notification_message(app->notifications, &sequence_success);
furi_string_reset(app->file_name);
scene_manager_next_scene(app->scene_manager, LfRfidSceneReadSuccess);
DOLPHIN_DEED(DolphinDeedRfidReadSuccess);
dolphin_deed(DolphinDeedRfidReadSuccess);
consumed = true;
} else if(event.event == LfRfidEventReadStartPSK) {
if(app->read_type == LFRFIDWorkerReadTypeAuto) {
@@ -44,7 +44,7 @@ bool lfrfid_scene_read_key_menu_on_event(void* context, SceneManagerEvent event)
consumed = true;
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(app->scene_manager, LfRfidSceneEmulate);
DOLPHIN_DEED(DolphinDeedRfidEmulate);
dolphin_deed(DolphinDeedRfidEmulate);
consumed = true;
}
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneReadKeyMenu, event.event);
@@ -59,9 +59,9 @@ bool lfrfid_scene_save_name_on_event(void* context, SceneManagerEvent event) {
if(scene_manager_has_previous_scene(scene_manager, LfRfidSceneSavedKeyMenu)) {
// Nothing, do not count editing as saving
} else if(scene_manager_has_previous_scene(scene_manager, LfRfidSceneSaveType)) {
DOLPHIN_DEED(DolphinDeedRfidAdd);
dolphin_deed(DolphinDeedRfidAdd);
} else {
DOLPHIN_DEED(DolphinDeedRfidSave);
dolphin_deed(DolphinDeedRfidSave);
}
} else {
scene_manager_search_and_switch_to_previous_scene(
@@ -43,7 +43,7 @@ bool lfrfid_scene_saved_key_menu_on_event(void* context, SceneManagerEvent event
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(app->scene_manager, LfRfidSceneEmulate);
DOLPHIN_DEED(DolphinDeedRfidEmulate);
dolphin_deed(DolphinDeedRfidEmulate);
consumed = true;
} else if(event.event == SubmenuIndexWrite) {
scene_manager_next_scene(app->scene_manager, LfRfidSceneWrite);
@@ -49,7 +49,7 @@ bool lfrfid_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.event == SubmenuIndexRead) {
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexRead);
scene_manager_next_scene(app->scene_manager, LfRfidSceneRead);
DOLPHIN_DEED(DolphinDeedRfidRead);
dolphin_deed(DolphinDeedRfidRead);
consumed = true;
} else if(event.event == SubmenuIndexSaved) {
// Like in the other apps, explicitly save the scene state
+4 -4
View File
@@ -287,19 +287,19 @@ int32_t nfc_app(char* p) {
if(nfc_device_load(nfc->dev, p, true)) {
if(nfc->dev->format == NfcDeviceSaveFormatMifareUl) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightEmulate);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatMifareClassic) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicEmulate);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatNfcV) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatBankCard) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDeviceInfo);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
} else {
// Exit app
@@ -111,7 +111,7 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
} else {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
}
} else if(event.event == NfcWorkerEventAborted) {
@@ -123,7 +123,7 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicReadSuccess);
// Counting failed attempts too
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
}
} else if(event.event == NfcWorkerEventCardDetected) {
@@ -37,7 +37,7 @@ bool nfc_scene_mf_classic_keys_add_on_event(void* context, SceneManagerEvent eve
nfc->scene_manager, NfcSceneMfClassicKeysWarnDuplicate);
} else if(mf_classic_dict_add_key(dict, nfc->byte_input_store)) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveSuccess);
DOLPHIN_DEED(DolphinDeedNfcMfcAdd);
dolphin_deed(DolphinDeedNfcMfcAdd);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
}
@@ -54,14 +54,14 @@ bool nfc_scene_mf_classic_menu_on_event(void* context, SceneManagerEvent event)
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicEmulate);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
dolphin_deed(DolphinDeedNfcAddEmulate);
} else {
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
consumed = true;
} else if(event.event == SubmenuIndexDetectReader) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDetectReader);
DOLPHIN_DEED(DolphinDeedNfcDetectReader);
dolphin_deed(DolphinDeedNfcDetectReader);
consumed = true;
} else if(event.event == SubmenuIndexInfo) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcDataInfo);
@@ -34,7 +34,7 @@ static void nfc_scene_mf_classic_update_setup_view(Nfc* nfc) {
void nfc_scene_mf_classic_update_on_enter(void* context) {
Nfc* nfc = context;
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneMfClassicUpdate, NfcSceneMfClassicUpdateStateCardSearch);
@@ -8,7 +8,7 @@ void nfc_scene_mf_classic_update_success_popup_callback(void* context) {
void nfc_scene_mf_classic_update_success_on_enter(void* context) {
Nfc* nfc = context;
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
notification_message(nfc->notifications, &sequence_success);
@@ -34,7 +34,7 @@ static void nfc_scene_mf_classic_write_setup_view(Nfc* nfc) {
void nfc_scene_mf_classic_write_on_enter(void* context) {
Nfc* nfc = context;
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneMfClassicWrite, NfcSceneMfClassicWriteStateCardSearch);
@@ -8,7 +8,7 @@ void nfc_scene_mf_classic_write_success_popup_callback(void* context) {
void nfc_scene_mf_classic_write_success_on_enter(void* context) {
Nfc* nfc = context;
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
notification_message(nfc->notifications, &sequence_success);
@@ -50,9 +50,9 @@ bool nfc_scene_mf_desfire_menu_on_event(void* context, SceneManagerEvent event)
} else if(event.event == SubmenuIndexEmulateUid) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
dolphin_deed(DolphinDeedNfcAddEmulate);
} else {
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
consumed = true;
} else if(event.event == SubmenuIndexInfo) {
@@ -60,9 +60,9 @@ bool nfc_scene_mf_ultralight_menu_on_event(void* context, SceneManagerEvent even
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightEmulate);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
dolphin_deed(DolphinDeedNfcAddEmulate);
} else {
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
consumed = true;
} else if(event.event == SubmenuIndexUnlock) {
@@ -61,7 +61,7 @@ bool nfc_scene_mf_ultralight_unlock_warn_on_event(void* context, SceneManagerEve
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == DialogExResultRight) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
consumed = true;
} else if(event.event == DialogExResultLeft) {
if(auth_method == MfUltralightAuthMethodAuto) {
@@ -79,7 +79,7 @@ bool nfc_scene_mf_ultralight_unlock_warn_on_event(void* context, SceneManagerEve
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == DialogExResultCenter) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
consumed = true;
}
}
@@ -43,9 +43,9 @@ bool nfc_scene_nfca_menu_on_event(void* context, SceneManagerEvent event) {
} else if(event.event == SubmenuIndexEmulateUid) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
dolphin_deed(DolphinDeedNfcAddEmulate);
} else {
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
consumed = true;
} else if(event.event == SubmenuIndexInfo) {
@@ -32,7 +32,7 @@ bool nfc_scene_nfcv_key_input_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventByteInputDone) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVUnlock);
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
consumed = true;
}
}
@@ -42,9 +42,9 @@ bool nfc_scene_nfcv_menu_on_event(void* context, SceneManagerEvent event) {
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
dolphin_deed(DolphinDeedNfcAddEmulate);
} else {
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
}
consumed = true;
} else if(event.event == SubmenuIndexInfo) {
@@ -76,7 +76,7 @@ void nfc_scene_nfcv_unlock_set_state(Nfc* nfc, NfcSceneNfcVUnlockState state) {
popup_set_timeout(popup, 1500);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
} else if(state == NfcSceneNfcVUnlockStateAlreadyUnlocked) {
popup_reset(popup);
@@ -45,7 +45,7 @@ bool nfc_scene_nfcv_unlock_menu_on_event(void* context, SceneManagerEvent event)
} else if(event.event == SubmenuIndexNfcVUnlockMenuTonieBox) {
nfc->dev->dev_data.nfcv_data.auth_method = NfcVAuthMethodTonieBox;
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVUnlock);
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
consumed = true;
}
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneNfcVUnlockMenu, event.event);
@@ -60,34 +60,34 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
(event.event == NfcWorkerEventReadUidNfcV)) {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadCardSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadUidNfcA) {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcaReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadNfcV) {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadMfUltralight) {
notification_message(nfc->notifications, &sequence_success);
// Set unlock password input to 0xFFFFFFFF only on fresh read
memset(nfc->byte_input_store, 0xFF, sizeof(nfc->byte_input_store));
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadMfClassicDone) {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadMfDesfire) {
notification_message(nfc->notifications, &sequence_success);
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfDesfireReadSuccess);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadBankCard) {
notification_message(nfc->notifications, &sequence_success);
@@ -67,9 +67,9 @@ bool nfc_scene_save_name_on_event(void* context, SceneManagerEvent event) {
if(!scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) {
// Nothing, do not count editing as saving
} else if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddSave);
dolphin_deed(DolphinDeedNfcAddSave);
} else {
DOLPHIN_DEED(DolphinDeedNfcSave);
dolphin_deed(DolphinDeedNfcSave);
}
consumed = true;
} else {
@@ -125,11 +125,11 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) {
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
}
DOLPHIN_DEED(DolphinDeedNfcEmulate);
dolphin_deed(DolphinDeedNfcEmulate);
consumed = true;
} else if(event.event == SubmenuIndexDetectReader) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDetectReader);
DOLPHIN_DEED(DolphinDeedNfcDetectReader);
dolphin_deed(DolphinDeedNfcDetectReader);
consumed = true;
} else if(event.event == SubmenuIndexWrite) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicWrite);
@@ -55,7 +55,7 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexRead);
nfc->dev->dev_data.read_mode = NfcReadModeAuto;
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
DOLPHIN_DEED(DolphinDeedNfcRead);
dolphin_deed(DolphinDeedNfcRead);
consumed = true;
} else if(event.event == SubmenuIndexDetectReader) {
scene_manager_set_scene_state(
@@ -64,7 +64,7 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
if(sd_exist) {
nfc_device_data_clear(&nfc->dev->dev_data);
scene_manager_next_scene(nfc->scene_manager, NfcSceneDetectReader);
DOLPHIN_DEED(DolphinDeedNfcDetectReader);
dolphin_deed(DolphinDeedNfcDetectReader);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
}
@@ -226,7 +226,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
} else {
if(scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneSaved) ||
!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneStart)) {
DOLPHIN_DEED(DolphinDeedSubGhzSend);
dolphin_deed(DolphinDeedSubGhzSend);
}
// set callback end tx
subghz_txrx_set_raw_file_encoder_worker_callback_end(
@@ -288,7 +288,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
} else {
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
if(subghz_protocol_raw_save_to_file_init(decoder_raw, RAW_FILE_NAME, &preset)) {
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
dolphin_deed(DolphinDeedSubGhzRawRec);
subghz_txrx_rx_start(subghz->txrx);
subghz->state_notifications = SubGhzNotificationStateRx;
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
@@ -223,7 +223,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
// Show file info, scene: receiver_info
subghz->idx_menu_chosen = subghz_view_receiver_get_idx_menu(subghz->subghz_receiver);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverInfo);
DOLPHIN_DEED(DolphinDeedSubGhzReceiverInfo);
dolphin_deed(DolphinDeedSubGhzReceiverInfo);
consumed = true;
break;
case SubGhzCustomEventViewReceiverDeleteItem:
@@ -180,9 +180,9 @@ bool subghz_scene_save_name_on_event(void* context, SceneManagerEvent event) {
// Ditto, for RAW signals
} else if(scene_manager_has_previous_scene(
subghz->scene_manager, SubGhzSceneSetType)) {
DOLPHIN_DEED(DolphinDeedSubGhzAddManually);
dolphin_deed(DolphinDeedSubGhzAddManually);
} else {
DOLPHIN_DEED(DolphinDeedSubGhzSave);
dolphin_deed(DolphinDeedSubGhzSave);
}
return true;
} else {
@@ -114,7 +114,7 @@ bool subghz_scene_start_on_event(void* context, SceneManagerEvent event) {
scene_manager_set_scene_state(
subghz->scene_manager, SubGhzSceneStart, SubmenuIndexFrequencyAnalyzer);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneFrequencyAnalyzer);
DOLPHIN_DEED(DolphinDeedSubGhzFrequencyAnalyzer);
dolphin_deed(DolphinDeedSubGhzFrequencyAnalyzer);
return true;
} else if(event.event == SubmenuIndexTest) {
scene_manager_set_scene_state(
@@ -91,7 +91,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
if(subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
subghz->state_notifications = SubGhzNotificationStateTx;
subghz_scene_transmitter_update_data_show(subghz);
DOLPHIN_DEED(DolphinDeedSubGhzSend);
dolphin_deed(DolphinDeedSubGhzSend);
}
return true;
} else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
@@ -68,7 +68,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
notification_message(app->notifications, &sequence_blink_magenta_10);
} else if(event.event == U2fCustomEventAuthSuccess) {
notification_message_block(app->notifications, &sequence_set_green_255);
DOLPHIN_DEED(DolphinDeedU2fAuthorized);
dolphin_deed(DolphinDeedU2fAuthorized);
furi_timer_start(app->timer, U2F_SUCCESS_TIMEOUT);
app->event_cur = U2fCustomEventNone;
u2f_view_set_state(app->u2f_view, U2fMsgSuccess);
@@ -34,13 +34,13 @@ bool desktop_scene_debug_on_event(void* context, SceneManagerEvent event) {
break;
case DesktopDebugEventDeed:
dolphin_deed(dolphin, DolphinDeedTestRight);
dolphin_deed(DolphinDeedTestRight);
desktop_debug_get_dolphin_data(desktop->debug_view);
consumed = true;
break;
case DesktopDebugEventWrongDeed:
dolphin_deed(dolphin, DolphinDeedTestLeft);
dolphin_deed(DolphinDeedTestLeft);
desktop_debug_get_dolphin_data(desktop->debug_view);
consumed = true;
break;
+3 -2
View File
@@ -14,12 +14,13 @@
static void dolphin_update_clear_limits_timer_period(Dolphin* dolphin);
void dolphin_deed(Dolphin* dolphin, DolphinDeed deed) {
furi_assert(dolphin);
void dolphin_deed(DolphinDeed deed) {
Dolphin* dolphin = (Dolphin*)furi_record_open(RECORD_DOLPHIN);
DolphinEvent event;
event.type = DolphinEventTypeDeed;
event.deed = deed;
dolphin_event_send_async(dolphin, &event);
furi_record_close(RECORD_DOLPHIN);
}
DolphinStats dolphin_stats(Dolphin* dolphin) {
+1 -8
View File
@@ -26,18 +26,11 @@ typedef enum {
DolphinPubsubEventUpdate,
} DolphinPubsubEvent;
#define DOLPHIN_DEED(deed) \
do { \
Dolphin* dolphin = (Dolphin*)furi_record_open("dolphin"); \
dolphin_deed(dolphin, deed); \
furi_record_close("dolphin"); \
} while(0)
/** Deed complete notification. Call it on deed completion.
* See dolphin_deed.h for available deeds. In futures it will become part of assets.
* Thread safe, async
*/
void dolphin_deed(Dolphin* dolphin, DolphinDeed deed);
void dolphin_deed(DolphinDeed deed);
/** Retrieve dolphin stats
* Thread safe, blocking
+2 -2
View File
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,29.0,,
Version,+,30.0,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@@ -648,7 +648,7 @@ Function,+,dir_walk_read,DirWalkResult,"DirWalk*, FuriString*, FileInfo*"
Function,+,dir_walk_set_filter_cb,void,"DirWalk*, DirWalkFilterCb, void*"
Function,+,dir_walk_set_recursive,void,"DirWalk*, _Bool"
Function,-,div,div_t,"int, int"
Function,+,dolphin_deed,void,"Dolphin*, DolphinDeed"
Function,+,dolphin_deed,void,DolphinDeed
Function,+,dolphin_deed_get_app,DolphinApp,DolphinDeed
Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
1 entry status name type params
2 Version + 29.0 30.0
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
648 Function + dir_walk_set_filter_cb void DirWalk*, DirWalkFilterCb, void*
649 Function + dir_walk_set_recursive void DirWalk*, _Bool
650 Function - div div_t int, int
651 Function + dolphin_deed void Dolphin*, DolphinDeed DolphinDeed
652 Function + dolphin_deed_get_app DolphinApp DolphinDeed
653 Function + dolphin_deed_get_app_limit uint8_t DolphinApp
654 Function + dolphin_deed_get_weight uint8_t DolphinDeed
+2 -2
View File
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,29.0,,
Version,+,30.0,,
Header,+,applications/main/archive/helpers/favorite_timeout.h,,
Header,+,applications/main/fap_loader/fap_loader_app.h,,
Header,+,applications/main/subghz/helpers/subghz_txrx.h,,
@@ -800,7 +800,7 @@ Function,+,dir_walk_read,DirWalkResult,"DirWalk*, FuriString*, FileInfo*"
Function,+,dir_walk_set_filter_cb,void,"DirWalk*, DirWalkFilterCb, void*"
Function,+,dir_walk_set_recursive,void,"DirWalk*, _Bool"
Function,-,div,div_t,"int, int"
Function,+,dolphin_deed,void,"Dolphin*, DolphinDeed"
Function,+,dolphin_deed,void,DolphinDeed
Function,+,dolphin_deed_get_app,DolphinApp,DolphinDeed
Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
1 entry status name type params
2 Version + 29.0 30.0
3 Header + applications/main/archive/helpers/favorite_timeout.h
4 Header + applications/main/fap_loader/fap_loader_app.h
5 Header + applications/main/subghz/helpers/subghz_txrx.h
800 Function + dir_walk_set_filter_cb void DirWalk*, DirWalkFilterCb, void*
801 Function + dir_walk_set_recursive void DirWalk*, _Bool
802 Function - div div_t int, int
803 Function + dolphin_deed void Dolphin*, DolphinDeed DolphinDeed
804 Function + dolphin_deed_get_app DolphinApp DolphinDeed
805 Function + dolphin_deed_get_app_limit uint8_t DolphinApp
806 Function + dolphin_deed_get_weight uint8_t DolphinDeed
+42 -40
View File
@@ -4,6 +4,9 @@
#define TAG "FuriHalMemory"
// STM(TM) Copro(TM) bug(TM) workaround size
#define RAM2B_COPRO_GAP_SIZE_KB 2
typedef enum {
SRAM_A,
SRAM_B,
@@ -30,53 +33,47 @@ void furi_hal_memory_init() {
return;
}
if(!ble_glue_wait_for_c2_start(FURI_HAL_BT_C2_START_TIMEOUT)) {
FURI_LOG_E(TAG, "C2 start timeout");
return;
}
FuriHalMemory* memory = malloc(sizeof(FuriHalMemory));
const BleGlueC2Info* c2_ver = ble_glue_get_c2_info();
uint32_t sbrsa = (FLASH->SRRVR & FLASH_SRRVR_SBRSA_Msk) >> FLASH_SRRVR_SBRSA_Pos;
uint32_t snbrsa = (FLASH->SRRVR & FLASH_SRRVR_SNBRSA_Msk) >> FLASH_SRRVR_SNBRSA_Pos;
if(c2_ver->mode == BleGlueC2ModeStack) {
uint32_t sram2a_busy_size = (uint32_t)&__sram2a_free__ - (uint32_t)&__sram2a_start__;
uint32_t sram2a_unprotected_size = (32 - c2_ver->MemorySizeSram2A) * 1024;
uint32_t sram2b_unprotected_size = (32 - c2_ver->MemorySizeSram2B) * 1024;
uint32_t sram2a_busy_size = (uint32_t)&__sram2a_free__ - (uint32_t)&__sram2a_start__;
uint32_t sram2a_unprotected_size = (sbrsa)*1024;
uint32_t sram2b_unprotected_size = (snbrsa)*1024;
memory->region[SRAM_A].start = (uint8_t*)&__sram2a_free__;
memory->region[SRAM_B].start = (uint8_t*)&__sram2b_start__;
// STM(TM) Copro(TM) bug(TM) workaround
sram2b_unprotected_size -= 1024 * RAM2B_COPRO_GAP_SIZE_KB;
if(sram2a_unprotected_size > sram2a_busy_size) {
memory->region[SRAM_A].size = sram2a_unprotected_size - sram2a_busy_size;
} else {
memory->region[SRAM_A].size = 0;
memory->region[SRAM_A].start = (uint8_t*)&__sram2a_free__;
memory->region[SRAM_B].start = (uint8_t*)&__sram2b_start__;
if(sram2a_unprotected_size > sram2a_busy_size) {
memory->region[SRAM_A].size = sram2a_unprotected_size - sram2a_busy_size;
} else {
memory->region[SRAM_A].size = 0;
}
memory->region[SRAM_B].size = sram2b_unprotected_size;
FURI_LOG_I(
TAG, "SRAM2A: 0x%p, %lu", memory->region[SRAM_A].start, memory->region[SRAM_A].size);
FURI_LOG_I(
TAG, "SRAM2B: 0x%p, %lu", memory->region[SRAM_B].start, memory->region[SRAM_B].size);
if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) {
if((memory->region[SRAM_A].size > 0)) {
FURI_LOG_I(TAG, "SRAM2A clear");
memset(memory->region[SRAM_A].start, 0, memory->region[SRAM_A].size);
}
memory->region[SRAM_B].size = sram2b_unprotected_size;
FURI_LOG_I(
TAG, "SRAM2A: 0x%p, %lu", memory->region[SRAM_A].start, memory->region[SRAM_A].size);
FURI_LOG_I(
TAG, "SRAM2B: 0x%p, %lu", memory->region[SRAM_B].start, memory->region[SRAM_B].size);
if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) {
if((memory->region[SRAM_A].size > 0)) {
FURI_LOG_I(TAG, "SRAM2A clear");
memset(memory->region[SRAM_A].start, 0, memory->region[SRAM_A].size);
}
if((memory->region[SRAM_B].size > 0)) {
FURI_LOG_I(TAG, "SRAM2B clear");
memset(memory->region[SRAM_B].start, 0, memory->region[SRAM_B].size);
}
furi_hal_memory = memory;
FURI_LOG_I(TAG, "Enabled");
} else {
free(memory);
FURI_LOG_E(TAG, "No SRAM2 available");
if((memory->region[SRAM_B].size > 0)) {
FURI_LOG_I(TAG, "SRAM2B clear");
memset(memory->region[SRAM_B].start, 0, memory->region[SRAM_B].size);
}
furi_hal_memory = memory;
FURI_LOG_I(TAG, "Enabled");
} else {
free(memory);
FURI_LOG_E(TAG, "No Core2 available");
FURI_LOG_E(TAG, "No SRAM2 available");
}
}
@@ -89,15 +86,20 @@ void* furi_hal_memory_alloc(size_t size) {
return NULL;
}
void* allocated_memory = NULL;
FURI_CRITICAL_ENTER();
for(int i = 0; i < SRAM_MAX; i++) {
if(furi_hal_memory->region[i].size >= size) {
void* ptr = furi_hal_memory->region[i].start;
furi_hal_memory->region[i].start += size;
furi_hal_memory->region[i].size -= size;
return ptr;
allocated_memory = ptr;
break;
}
}
return NULL;
FURI_CRITICAL_EXIT();
return allocated_memory;
}
size_t furi_hal_memory_get_free() {
+2
View File
@@ -56,6 +56,8 @@ static int32_t __furi_thread_stdout_flush(FuriThread* thread);
/** Catch threads that are trying to exit wrong way */
__attribute__((__noreturn__)) void furi_thread_catch() { //-V1082
// If you're here it means you're probably doing something wrong
// with critical sections or with scheduler state
asm volatile("nop"); // extra magic
furi_crash("You are doing it wrong"); //-V779
__builtin_unreachable();
+18 -4
View File
@@ -45,12 +45,23 @@ class GitVersion:
if force_no_dirty != "":
dirty = False
if "SOURCE_DATE_EPOCH" in os.environ:
commit_date = datetime.utcfromtimestamp(
int(os.environ["SOURCE_DATE_EPOCH"])
)
else:
commit_date = datetime.strptime(
self._exec_git("log -1 --format=%cd").strip(),
"%a %b %d %H:%M:%S %Y %z",
)
return {
"GIT_COMMIT": commit,
"GIT_BRANCH": branch,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
"GIT_ORIGIN": ",".join(self._get_git_origins()),
"GIT_COMMIT_DATE": commit_date,
}
def _get_git_origins(self):
@@ -107,10 +118,11 @@ class Main(App):
def generate(self):
current_info = GitVersion(self.args.sourcedir).get_version_info()
if "SOURCE_DATE_EPOCH" in os.environ:
build_date = datetime.utcfromtimestamp(int(os.environ["SOURCE_DATE_EPOCH"]))
else:
build_date = date.today()
build_date = (
date.today()
if current_info["BUILD_DIRTY"]
else current_info["GIT_COMMIT_DATE"]
)
current_info.update(
{
@@ -120,6 +132,8 @@ class Main(App):
}
)
del current_info["GIT_COMMIT_DATE"]
version_values = []
for key in current_info:
val = current_info[key]