Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
V45 Release Candidate Changes (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 3, 2023
2 parents aa86bc5 + d43db3b commit e614249
Show file tree
Hide file tree
Showing 687 changed files with 16,405 additions and 5,268 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bindings/
Brewfile.lock.json

# Visual Studio Code
.vscode/
/.vscode/

# Visual Studio
.vs/
Expand Down
2 changes: 1 addition & 1 deletion .pvsoptions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/xtreme -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
21 changes: 13 additions & 8 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ Note, the below mentioned changes are only a few things we did. For a full list

We wrote a powerful yet easy-to-use application specifically for our Firmware, that gives you easy-access to all the fancy things we implemented:

<img src="https://user-images.githubusercontent.com/49810075/228392945-1e68b996-4e2c-46c6-8aae-d0aadd8ea001.gif" align="left" width="400px"/>
<!--
<ins><b>Interface:</b></ins>
Customize every bit of your Flipper, from the desktop animations, to the main menu apps, lockscreen style, statusbar items and screen options like dark mode and lefty mode(yes, we thought about you :3 ).
This image needs to be updated!
Also, perhaps a bigger height, with set width (yes distrotion issues ik) so it fits all our bulletpoints without issues
<ins><b>Protocols:</b></ins>
Here you can toggle USB & Bluetooth mode for our Bad-Keyboard app, and manage Subghz settings like custom frequencies and extend options.
-->

<ins><b>Misc:</b></ins>
All the other options that don't fit elsewhere. Change your Flipper's name, change xp level, and manage settings for RGB backlight.
<img src="https://user-images.githubusercontent.com/49810075/228392945-1e68b996-4e2c-46c6-8aae-d0aadd8ea001.gif" align="left" height="160vh"/>
<img align="left" height="180vh" width="10" src="https://upload.wikimedia.org/wikipedia/commons/3/3d/1_120_transparent.png">

<br clear="left"/>
- <ins><b>Interface:</b></ins> Customize every bit of your Flipper, from the desktop animations, to the main menu apps, lockscreen style etc.

- <ins><b>Protocols:</b></ins> Here you can toggle between USB & Bluetooth mode for <a href="https://github.com/ClaraCrazy/Flipper-Xtreme/wiki/Generic-Guides#badbt--kb">BadKB</a>, and manage custom Subghz frequencies.

- <ins><b>Misc:</b></ins> All the other options that don't fit elsewhere. Change your Flipper's name, xp level, and configure the <a href="https://github.com/Z3BRO/Flipper-Zero-RGB-Backlight">RGB backlight</a>.

<br>

-----
<br>
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/accessor/accessor_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void AccessorApp::run(void) {
exit = switch_to_previous_scene();
}
}
};
}

scenes[current_scene]->on_exit(this);

Expand Down
4 changes: 2 additions & 2 deletions applications/debug/battery_test_app/views/battery_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}

static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
Expand Down Expand Up @@ -85,7 +85,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}

static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
Expand Down
4 changes: 2 additions & 2 deletions applications/debug/uart_echo/application.fam
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
App(
appid="UART_Echo",
name="[GPIO] UART Echo",
apptype=FlipperAppType.EXTERNAL,
apptype=FlipperAppType.DEBUG,
entry_point="uart_echo_app",
cdefines=["APP_UART_ECHO"],
requires=["gui"],
stack_size=2 * 1024,
order=70,
fap_icon="uart_10px.png",
fap_category="GPIO",
fap_category="Debug",
)
150 changes: 150 additions & 0 deletions applications/debug/unit_tests/nfc/nfc_test.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <furi.h>
#include <furi_hal.h>
#include <stm32wbxx_ll_tim.h>
#include <storage/storage.h>
#include <lib/flipper_format/flipper_format.h>
#include <lib/nfc/protocols/nfca.h>
#include <lib/nfc/helpers/mf_classic_dict.h>
#include <lib/digital_signal/digital_signal.h>
#include <lib/pulse_reader/pulse_reader.h>
#include <lib/nfc/nfc_device.h>
#include <lib/nfc/helpers/nfc_generators.h>

Expand Down Expand Up @@ -179,6 +181,153 @@ MU_TEST(nfc_digital_signal_test) {
"NFC long digital signal test failed\r\n");
}

static bool nfc_test_pulse_reader_toggle(
uint32_t usec_low,
uint32_t usec_high,
uint32_t period_count,
uint32_t tolerance) {
furi_assert(nfc_test);

bool success = false;
uint32_t pulses = 0;
const GpioPin* gpio_in = &gpio_ext_pa6;
const GpioPin* gpio_out = &gpio_ext_pa7;
PulseReader* reader = NULL;

do {
reader = pulse_reader_alloc(gpio_in, 512);

if(!reader) {
FURI_LOG_E(TAG, "failed to allocate pulse reader");
break;
}

/* use TIM1 to create a specific number of pulses with defined duty cycle
but first set the IO to high, so the low/high pulse can get detected */
furi_hal_gpio_init(gpio_out, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
furi_hal_gpio_write(gpio_out, true);

LL_TIM_DeInit(TIM1);

LL_TIM_SetCounterMode(TIM1, LL_TIM_COUNTERMODE_UP);
LL_TIM_SetRepetitionCounter(TIM1, 0);
LL_TIM_SetClockDivision(TIM1, LL_TIM_CLOCKDIVISION_DIV1);
LL_TIM_SetClockSource(TIM1, LL_TIM_CLOCKSOURCE_INTERNAL);
LL_TIM_DisableARRPreload(TIM1);

LL_TIM_OC_DisablePreload(TIM1, LL_TIM_CHANNEL_CH1);
LL_TIM_OC_SetMode(TIM1, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_PWM2);
LL_TIM_OC_SetPolarity(TIM1, LL_TIM_CHANNEL_CH1N, LL_TIM_OCPOLARITY_HIGH);
LL_TIM_OC_DisableFast(TIM1, LL_TIM_CHANNEL_CH1);
LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH1N);

LL_TIM_EnableAllOutputs(TIM1);

/* now calculate the TIM1 period and compare values */
uint32_t freq_div = 64 * (usec_low + usec_high);
uint32_t prescaler = freq_div / 0x10000LU;
uint32_t period = freq_div / (prescaler + 1);
uint32_t compare = 64 * usec_low / (prescaler + 1);

LL_TIM_SetPrescaler(TIM1, prescaler);
LL_TIM_SetAutoReload(TIM1, period - 1);
LL_TIM_SetCounter(TIM1, period - 1);
LL_TIM_OC_SetCompareCH1(TIM1, compare);

/* timer is ready to launch, now start the pulse reader */
pulse_reader_set_timebase(reader, PulseReaderUnitMicrosecond);
pulse_reader_start(reader);

/* and quickly enable and switch over the GPIO to the generated signal */
LL_TIM_EnableCounter(TIM1);
furi_hal_gpio_init_ex(
gpio_out, GpioModeAltFunctionPushPull, GpioPullNo, GpioSpeedVeryHigh, GpioAltFn1TIM1);

/* now it's time to parse the pulses received by the reader */
uint32_t timer_pulses = period_count;
uint32_t prev_cnt = 0;

while(timer_pulses > 0) {
/* whenever the counter gets reset, we went through a full period */
uint32_t cur_cnt = LL_TIM_GetCounter(TIM1);
if(cur_cnt < prev_cnt) {
timer_pulses--;
}
prev_cnt = cur_cnt;
}
/* quickly halt the counter to keep a static signal */
LL_TIM_DisableCounter(TIM1);

do {
/* as all edges were sampled asynchronously, the timeout can be zero */
uint32_t length = pulse_reader_receive(reader, 0);

/* in the last pulse, we expect a "no edge" return value. if seen that, test succeeded. */
if(pulses > period_count * 2) {
if(length != PULSE_READER_NO_EDGE) {
FURI_LOG_E(
TAG,
"last pulse expected to be PULSE_READER_NO_EDGE, but was %lu.",
length);
break;
}
success = true;
break;
}

/* else we shall never see "no edge" or "lost edge" */
if(length == PULSE_READER_NO_EDGE) {
FURI_LOG_E(TAG, "%lu. pulse not expected to be PULSE_READER_NO_EDGE", pulses);
break;
}
if(length == PULSE_READER_LOST_EDGE) {
FURI_LOG_E(TAG, "%lu. pulse not expected to be PULSE_READER_LOST_EDGE", pulses);
break;
}

if(pulses > 0) {
/* throw away the first pulse, which is the 1->0 from the first start and will be irrelevant for our test */
bool phase = ((pulses - 1) % 2) == 1;
uint32_t expected = phase ? usec_high : usec_low;
uint32_t deviation = abs((int32_t)length - (int32_t)expected);

if(deviation > tolerance) {
FURI_LOG_E(
TAG,
"%lu. pulse expected %lu, but pulse was %lu.",
pulses,
expected,
length);
break;
}
}
pulses++;
} while(true);
} while(false);

if(reader != NULL) {
pulse_reader_stop(reader);
pulse_reader_free(reader);
}

LL_TIM_DeInit(TIM1);
furi_hal_gpio_init_simple(gpio_in, GpioModeAnalog);
furi_hal_gpio_init_simple(gpio_out, GpioModeAnalog);

return success;
}

MU_TEST(nfc_pulse_reader_test) {
mu_assert(nfc_test_pulse_reader_toggle(1500, 2500, 50, 10), "1 ms signal failed\r\n");
mu_assert(nfc_test_pulse_reader_toggle(10000, 10000, 10, 10), "10 ms signal failed\r\n");
mu_assert(nfc_test_pulse_reader_toggle(100000, 100000, 5, 50), "100 ms signal failed\r\n");
mu_assert(nfc_test_pulse_reader_toggle(100, 900, 50, 10), "1 ms asymmetric signal failed\r\n");
mu_assert(
nfc_test_pulse_reader_toggle(3333, 6666, 10, 10), "10 ms asymmetric signal failed\r\n");
mu_assert(
nfc_test_pulse_reader_toggle(25000, 75000, 5, 10), "100 ms asymmetric signal failed\r\n");
}

MU_TEST(mf_classic_dict_test) {
MfClassicDict* instance = NULL;
uint64_t key = 0;
Expand Down Expand Up @@ -513,6 +662,7 @@ MU_TEST(mf_classic_4k_7b_file_test) {
MU_TEST_SUITE(nfc) {
nfc_test_alloc();

MU_RUN_TEST(nfc_pulse_reader_test);
MU_RUN_TEST(nfca_file_test);
MU_RUN_TEST(mf_mini_file_test);
MU_RUN_TEST(mf_classic_1k_4b_file_test);
Expand Down
4 changes: 2 additions & 2 deletions applications/debug/unit_tests/rpc/rpc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void test_rpc_setup(void) {

rpc = furi_record_open(RECORD_RPC);
for(int i = 0; !(rpc_session[0].session) && (i < 10000); ++i) {
rpc_session[0].session = rpc_session_open(rpc);
rpc_session[0].session = rpc_session_open(rpc, RpcOwnerUnknown);
furi_delay_tick(1);
}
furi_check(rpc_session[0].session);
Expand All @@ -104,7 +104,7 @@ static void test_rpc_setup_second_session(void) {
furi_check(!(rpc_session[1].session));

for(int i = 0; !(rpc_session[1].session) && (i < 10000); ++i) {
rpc_session[1].session = rpc_session_open(rpc);
rpc_session[1].session = rpc_session_open(rpc, RpcOwnerUnknown);
furi_delay_tick(1);
}
furi_check(rpc_session[1].session);
Expand Down
2 changes: 1 addition & 1 deletion applications/external/airmouse/tracking/util/matrix_4x4.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ class Matrix4x4 {

} // namespace cardboard

#endif // CARDBOARD_SDK_UTIL_MATRIX4X4_H_
#endif // CARDBOARD_SDK_UTIL_MATRIX_4X4_H_
2 changes: 1 addition & 1 deletion applications/external/asteroids/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ App(
stack_size=8 * 1024,
order=50,
fap_icon="appicon.png",
fap_icon_assets="assets", # Image assets to compile for this application
fap_category="Games",
fap_icon_assets="assets", # Image assets to compile for this application
fap_description="An implementation of the classic arcade game Asteroids",
fap_author="antirez, SimplyMinimal",
fap_weburl="https://github.com/SimplyMinimal/FlipperZero-Asteroids",
Expand Down
25 changes: 15 additions & 10 deletions applications/external/avr_isp_programmer/helpers/avr_isp.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ bool avr_isp_auto_set_spi_speed_start_pmode(AvrIsp* instance) {
}
}
}
if(instance->spi) avr_isp_spi_sw_free(instance->spi);

if(instance->spi) {
avr_isp_spi_sw_free(instance->spi);
instance->spi = NULL;
}

return false;
}

Expand All @@ -169,7 +174,7 @@ static void avr_isp_commit(AvrIsp* instance, uint16_t addr, uint8_t data) {
while((furi_get_tick() - starttime) < 30) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr)) != 0xFF) {
break;
};
}
}
}
}
Expand Down Expand Up @@ -352,7 +357,7 @@ uint8_t avr_isp_read_lock_byte(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == data) {
break;
};
}
data = 0x00;
}
return data;
Expand All @@ -372,7 +377,7 @@ bool avr_isp_write_lock_byte(AvrIsp* instance, uint8_t lock) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == lock) {
ret = true;
break;
};
}
}
}
return ret;
Expand All @@ -387,7 +392,7 @@ uint8_t avr_isp_read_fuse_low(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == data) {
break;
};
}
data = 0x00;
}
return data;
Expand All @@ -407,7 +412,7 @@ bool avr_isp_write_fuse_low(AvrIsp* instance, uint8_t lfuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == lfuse) {
ret = true;
break;
};
}
}
}
return ret;
Expand All @@ -422,7 +427,7 @@ uint8_t avr_isp_read_fuse_high(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == data) {
break;
};
}
data = 0x00;
}
return data;
Expand All @@ -442,7 +447,7 @@ bool avr_isp_write_fuse_high(AvrIsp* instance, uint8_t hfuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == hfuse) {
ret = true;
break;
};
}
}
}
return ret;
Expand All @@ -457,7 +462,7 @@ uint8_t avr_isp_read_fuse_extended(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == data) {
break;
};
}
data = 0x00;
}
return data;
Expand All @@ -477,7 +482,7 @@ bool avr_isp_write_fuse_extended(AvrIsp* instance, uint8_t efuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == efuse) {
ret = true;
break;
};
}
}
}
return ret;
Expand Down
Loading

0 comments on commit e614249

Please sign in to comment.