Merge branch 'analyzer-decoder' of https://github.com/ALEEF02/unleashed-firmware-subghz-analyzer into analyzer-decoder
49
CHANGELOG.md
@ -1,45 +1,14 @@
|
|||||||
## New changes
|
## New changes
|
||||||
* !!! **Warning! After installing, Desktop settings (Favoutite apps, PIN Code, AutoLock time..) will be resetted to default due to settings changes, Please set your PIN code, Favourite apps again in Settings->Desktop** !!!
|
* SubGHz: OFW PR: change the operation of the TIM17 timer in CC1101_ext to 2µs -> **CAME Atomo and other protocols issues with external module should be fixed now**
|
||||||
* This next text applies to you only **If you have copied any apps manually** into `apps` folder and don't know that you need to update those apps manually in same way you added them - remove `apps` folder or that specific apps you copied on your microSD before installing this release to avoid issues due to OFW API version update! **If you using regular builds or extra pack builds (e) without your manually added apps, all included apps will be installed automatically, no extra actions needed!**
|
* SubGHz: Temporatily revert new AM_Q in default modulations due to external CC1101 module issues
|
||||||
-----
|
* Plugins: NRF24 MouseJacker -> Fixed issue #551 - Wrong folder path
|
||||||
* Archive (FileBrowser): Added Cut/Copy/Paste & NewDir options in new menu (original feature made by (@Willy-JL | XFW) - and ported by @gid9798)
|
* Plugins: Spectrum Analyzer -> Add a Precise mode and other small changes (by @ALEEF02 | PR #550 #553)
|
||||||
* Plugins: SubGHz Bruteforcer (3.7 update) - New extra settings menu (by @gid9798)
|
|
||||||
```
|
|
||||||
- Added the ability to change repeats
|
|
||||||
- Added the ability to change Te for protocols that use it
|
|
||||||
- The settings will be reset after returning to the main menu
|
|
||||||
```
|
|
||||||
* SubGHz Remote: Merged SubGHz Remote and Remote maker in one app, **use back button to access remote maker** (by @gid9798 | PR #545)
|
|
||||||
* SubGHz: Replace FM15k with AM_Q in default modulations
|
|
||||||
* SubGHz: Port latest OFW external radio driver, fix issues (now you can make drivers for other radio chips) (by @gid9798 | PR #539 #536 #535 #534)
|
|
||||||
* GUI module: SubMenu fix vertical orientation (by @gid9798 | PR #543)
|
|
||||||
* Apps: After merge fixes (by @gid9798 | PR #537)
|
|
||||||
* Docs: Update docs for debug build and update vscode example, please remove `debug_pack` target if you had it in your workflow
|
|
||||||
* Infrared: Updated universal remote assets (by @amec0e | PR #544 #546)
|
|
||||||
* Plugins: Barcode app - embed assets (encoding tables) in plugin
|
|
||||||
* Plugins: NRF24 plugins -> Updates by @Sil333033 with some changes by @xMasterX -> furi_hal_speaker direct calls was removed and replaced with notification service to avoid bypassing of user set silent mode -> What was changed - NRF24 connection check added, app folders was moved (uses migrate, all done automatically), and mousejacker now uses badusb folder for badusb scripts
|
|
||||||
* Plugins: Added Camera Suite GPIO application for the ESP32-CAM module. [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite) (PR #541)
|
|
||||||
* Plugins: Updated ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-wifi-marauder)
|
|
||||||
* Plugins: Updated **NFC Maker** plugin (make tags with URLs, Wifi and other things) [(by Willy-JL)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/external/nfc_maker)
|
|
||||||
* Plugins: Updated **Mifare Nested** [(by AloneLiberty)](https://github.com/AloneLiberty/FlipperNested)
|
|
||||||
* Plugins: Updated Lightmeter [(by oleksiikutuzov)](https://github.com/oleksiikutuzov/flipperzero-lightmeter)
|
* Plugins: Updated Lightmeter [(by oleksiikutuzov)](https://github.com/oleksiikutuzov/flipperzero-lightmeter)
|
||||||
* Plugins: Updated **Multi (RFID/iButton) Fuzzer** [(by @gid9798)](https://github.com/DarkFlippers/Multi_Fuzzer)
|
* Plugins: Various uFBT fixes (by @hedger)
|
||||||
* OFW PR: faploader: always create app dir, even if it doesn't have subdirs (by @hedger)
|
* Infrared: Universal remote assets - Add Xiaomi TV and (Daikin AC from OFW PR 2913 by minchogaydarov)
|
||||||
* OFW: Gauge initialization routine refactoring, new DataMemory layout, configuration update
|
* OFW PR 2912: NFC: Fix key invalidation (again) (by AloneLiberty)
|
||||||
* OFW: fbt: `build` target for faps
|
* OFW PR 2907: Fix about screen (by andzhr)
|
||||||
* OFW: IButton: on delete scene key name not fully display if so long
|
* OFW PR 2896: BadUSB - Added French Canadian layout (by francis2054)
|
||||||
* OFW: Radio headers in SDK
|
|
||||||
* OFW: Loader: good looking error messages
|
|
||||||
* OFW: Desktop,Cli: add uptime info
|
|
||||||
* OFW: Archive and file browser fixes
|
|
||||||
* OFW: Loader: exit animation fix
|
|
||||||
* OFW: SubGhz: fix check connect cc1101_ext
|
|
||||||
* OFW: NFC: Improved MFC emulation on some readers
|
|
||||||
* OFW: Dolphin: add new animation
|
|
||||||
* OFW: Update toolchain to v23
|
|
||||||
* OFW: More descriptive error messages for the log command
|
|
||||||
* OFW: **External menu apps** -> now we have ton of free internal space
|
|
||||||
* OFW: Device Info update
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ You can support us by using links or addresses below:
|
|||||||
- ESP32-CAM -> Camera Suite [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite)
|
- ESP32-CAM -> Camera Suite [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite)
|
||||||
|
|
||||||
Games:
|
Games:
|
||||||
- DOOM (fixed) [(by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
|
- DOOM (ported and fixed by @xMasterX & @Svarich & @hedger) [(original by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
|
||||||
- Zombiez [(Reworked By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/240) [(Original By Dooskington)](https://github.com/Dooskington/flipperzero-zombiez)
|
- Zombiez [(Reworked By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/240) [(Original By Dooskington)](https://github.com/Dooskington/flipperzero-zombiez)
|
||||||
- Flappy Bird [(by DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
|
- Flappy Bird [(by DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
|
||||||
- Arkanoid (refactored by xMasterX) [(by gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins)
|
- Arkanoid (refactored by xMasterX) [(by gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins)
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL (256)
|
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL (256)
|
||||||
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_HALF \
|
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_HALF \
|
||||||
(SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL / 2)
|
(SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL / 2)
|
||||||
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_GUARD_TIME 999
|
#define SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_GUARD_TIME 999 << 1
|
||||||
|
|
||||||
/** SubGhz state */
|
/** SubGhz state */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -500,7 +500,7 @@ static void subghz_device_cc1101_ext_capture_ISR() {
|
|||||||
|
|
||||||
subghz_device_cc1101_ext->async_rx.capture_callback(
|
subghz_device_cc1101_ext->async_rx.capture_callback(
|
||||||
true,
|
true,
|
||||||
LL_TIM_GetCounter(TIM17),
|
LL_TIM_GetCounter(TIM17) << 1,
|
||||||
(void*)subghz_device_cc1101_ext->async_rx.capture_callback_context);
|
(void*)subghz_device_cc1101_ext->async_rx.capture_callback_context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -510,11 +510,11 @@ static void subghz_device_cc1101_ext_capture_ISR() {
|
|||||||
|
|
||||||
subghz_device_cc1101_ext->async_rx.capture_callback(
|
subghz_device_cc1101_ext->async_rx.capture_callback(
|
||||||
false,
|
false,
|
||||||
LL_TIM_GetCounter(TIM17),
|
LL_TIM_GetCounter(TIM17) << 1,
|
||||||
(void*)subghz_device_cc1101_ext->async_rx.capture_callback_context);
|
(void*)subghz_device_cc1101_ext->async_rx.capture_callback_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LL_TIM_SetCounter(TIM17, 6);
|
LL_TIM_SetCounter(TIM17, 4); //8>>1
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_device_cc1101_ext_start_async_rx(
|
void subghz_device_cc1101_ext_start_async_rx(
|
||||||
@ -529,7 +529,8 @@ void subghz_device_cc1101_ext_start_async_rx(
|
|||||||
furi_hal_bus_enable(FuriHalBusTIM17);
|
furi_hal_bus_enable(FuriHalBusTIM17);
|
||||||
|
|
||||||
// Configure TIM
|
// Configure TIM
|
||||||
LL_TIM_SetPrescaler(TIM17, 64 - 1);
|
//Set the timer resolution to 2 µs
|
||||||
|
LL_TIM_SetPrescaler(TIM17, (64 << 1) - 1);
|
||||||
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
|
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
|
||||||
LL_TIM_SetAutoReload(TIM17, 0xFFFF);
|
LL_TIM_SetAutoReload(TIM17, 0xFFFF);
|
||||||
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
|
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
|
||||||
@ -623,7 +624,7 @@ static void subghz_device_cc1101_ext_async_tx_refill(uint32_t* buffer, size_t sa
|
|||||||
|
|
||||||
uint32_t duration = level_duration_get_duration(ld);
|
uint32_t duration = level_duration_get_duration(ld);
|
||||||
furi_assert(duration > 0);
|
furi_assert(duration > 0);
|
||||||
*buffer = duration - 1;
|
*buffer = duration >> 1;
|
||||||
buffer++;
|
buffer++;
|
||||||
samples--;
|
samples--;
|
||||||
}
|
}
|
||||||
@ -709,7 +710,8 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
|
|||||||
furi_hal_bus_enable(FuriHalBusTIM17);
|
furi_hal_bus_enable(FuriHalBusTIM17);
|
||||||
|
|
||||||
// Configure TIM
|
// Configure TIM
|
||||||
LL_TIM_SetPrescaler(TIM17, 64 - 1);
|
// Set the timer resolution to 2 µs
|
||||||
|
LL_TIM_SetPrescaler(TIM17, (64 << 1) - 1);
|
||||||
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
|
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
|
||||||
LL_TIM_SetAutoReload(TIM17, 0xFFFF);
|
LL_TIM_SetAutoReload(TIM17, 0xFFFF);
|
||||||
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
|
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
|
||||||
|
4
applications/external/doom/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
dist/*
|
||||||
|
.vscode
|
||||||
|
.clang-format
|
||||||
|
.editorconfig
|
70
applications/external/doom/README.md
vendored
@ -1,68 +1,10 @@
|
|||||||
# Doom Flipper Zero edition
|
# Doom Flipper Zero edition
|
||||||
|
|
||||||
<div style="text-align:center"><img src="assets/logo_inv.png"/></div>
|
|
||||||
|
|
||||||
## Will it run Doom?
|
## Will it run Doom?
|
||||||
As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware.<br> This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano (https://github.com/daveruiz/doom-nano/). This port is basically a raycasting engine, using Doom sprites.<br>
|
As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware. This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano - https://github.com/daveruiz/doom-nano/. This port is basically a raycasting engine, using Doom sprites.
|
||||||
This version is very basic and might be improved over time.
|
This version is very basic and might be improved over time.
|
||||||
|
|
||||||
## How to install on Flipper Zero
|
## Credits
|
||||||
During the porting process, minor changes were made to the workings (and build options) of the current firmware. These changes are documented here and are necessary in order to get a working firmware build that contains this Doom port.
|
@xMasterX - Porting to latest firmware using new plugins system, fixing many issues, adding sound
|
||||||
### Modifying the firmware & build options
|
@Svaarich - New logo screen and cool icon
|
||||||
* In the `sites/cc.scons` add the following values to the `CCFLAGS` section:
|
@hedger - uFBT fixes and some bugfixes
|
||||||
```
|
@p4nic4ttack - First raw implementation based on doom-nano
|
||||||
...
|
|
||||||
"-Wno-unused-parameter",
|
|
||||||
"-Wno-type-limits",
|
|
||||||
"-Wno-unused-variable",
|
|
||||||
...
|
|
||||||
```
|
|
||||||
* In `applications/gui/canvas_i.h` comment out the following line:<br>
|
|
||||||
`uint8_t* canvas_get_buffer(Canvas* canvas);` --> `//uint8_t* canvas_get_buffer(Canvas* canvas);`
|
|
||||||
|
|
||||||
* In `applications/gui/canvas.h` add the following lines:
|
|
||||||
```
|
|
||||||
uint8_t* canvas_get_buffer(Canvas* canvas);
|
|
||||||
void canvas_draw_icon_bitmap(Canvas* canvas, uint8_t x, uint8_t y, int16_t w, int16_t h, const Icon* icon);
|
|
||||||
```
|
|
||||||
* In `applications/gui/canvas.c` add the following function:
|
|
||||||
```
|
|
||||||
void canvas_draw_icon_bitmap(Canvas* canvas, uint8_t x, uint8_t y, int16_t w, int16_t h, const Icon* icon){
|
|
||||||
furi_assert(canvas);
|
|
||||||
furi_assert(icon);
|
|
||||||
|
|
||||||
x += canvas->offset_x;
|
|
||||||
y += canvas->offset_y;
|
|
||||||
uint8_t* icon_data = NULL;
|
|
||||||
furi_hal_compress_icon_decode(icon_get_data(icon), &icon_data);
|
|
||||||
u8g2_DrawXBM(&canvas->fb, x, y, w, h, icon_data);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Installing the plugin in the firmware
|
|
||||||
* Make a folder called Doom in the applications folder. Add all the source files (also the compiled folder and it's files) in the Doom folder.
|
|
||||||
* Make the `applications/meta/application.fam` look like the following:
|
|
||||||
```
|
|
||||||
App(
|
|
||||||
appid="basic_plugins",
|
|
||||||
name="Basic applications for plug-in menu",
|
|
||||||
apptype=FlipperAppType.METAPACKAGE,
|
|
||||||
provides=[
|
|
||||||
...
|
|
||||||
"doom_game",
|
|
||||||
...
|
|
||||||
|
|
||||||
],
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
If all went well the only thing left to do is building the firmware and installing it to the Flipper.
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
![Intro screen](assets/screenshot-intro2.jpg)
|
|
||||||
|
|
||||||
![Start screen](assets/screenshot-start2.jpg)
|
|
||||||
|
|
||||||
![Imp](assets/screenshot-imp2.jpg)
|
|
||||||
|
|
||||||
![Medkit](assets/screenshot-medkit2.jpg)
|
|
4
applications/external/doom/application.fam
vendored
@ -11,4 +11,8 @@ App(
|
|||||||
order=75,
|
order=75,
|
||||||
fap_icon="doom_10px.png",
|
fap_icon="doom_10px.png",
|
||||||
fap_category="Games",
|
fap_category="Games",
|
||||||
|
fap_icon_assets="assets",
|
||||||
|
fap_author="@xMasterX & @Svarich & @hedger (original code by @p4nic4ttack)",
|
||||||
|
fap_version="1.0",
|
||||||
|
fap_description="Will it run Doom?",
|
||||||
)
|
)
|
||||||
|
@ -1,78 +1,4 @@
|
|||||||
#include "assets_icons.h"
|
#include "assets.h"
|
||||||
|
|
||||||
#include <gui/icon_i.h>
|
|
||||||
|
|
||||||
// Inverted icons
|
|
||||||
|
|
||||||
const uint8_t _I_fire_inv_0[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x40, 0xee, 0x00, 0x80, 0xe6, 0x00,
|
|
||||||
0x80, 0xa7, 0x01, 0x80, 0xc7, 0x03, 0x40, 0x45, 0x03, 0xe0, 0x41, 0x07, 0xf8, 0x82, 0x9f, 0xb9,
|
|
||||||
0x01, 0x3e, 0x7c, 0x00, 0x7a, 0x6e, 0x00, 0x56, 0x1c, 0x00, 0x6c, 0xf4, 0x01, 0x3a, 0x6c, 0x00,
|
|
||||||
0x7e, 0xfc, 0x00, 0x1a, 0x08, 0x00, 0x3c, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
|
||||||
const uint8_t* const _I_fire_inv[] = {_I_fire_inv_0};
|
|
||||||
|
|
||||||
const uint8_t _I_gun_inv_0[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x80, 0x23, 0x00, 0x00, 0x40,
|
|
||||||
0x20, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x57, 0x00, 0x00, 0x20, 0x8b, 0x00, 0x00,
|
|
||||||
0x90, 0x11, 0x01, 0x00, 0x98, 0x00, 0x00, 0x00, 0xb0, 0x43, 0x01, 0x00, 0x94, 0x81, 0x03,
|
|
||||||
0x00, 0xd0, 0x45, 0x04, 0x00, 0x8c, 0x02, 0x02, 0x00, 0xc4, 0x00, 0x03, 0x00, 0xc8, 0x00,
|
|
||||||
0x02, 0x00, 0x4e, 0x40, 0x00, 0x00, 0x92, 0x00, 0x02, 0x80, 0x07, 0x15, 0x04, 0xe0, 0x8f,
|
|
||||||
0x00, 0x0c, 0xd0, 0x9d, 0x07, 0x17, 0xe0, 0x3a, 0xc0, 0x3f, 0xe0, 0xf7, 0xff, 0x77, 0xe0,
|
|
||||||
0xae, 0xfe, 0x4b, 0xd8, 0xdd, 0xff, 0x4d, 0x88, 0xea, 0xbe, 0x26, 0x4c, 0xf5, 0xff, 0x17,
|
|
||||||
0xc8, 0xfa, 0xae, 0x0b, 0xcc, 0xff, 0xdf, 0x19, 0xe8, 0xeb, 0xa7, 0x00, 0xd8, 0xf1, 0x4d,
|
|
||||||
0x0c, 0xc0, 0xbe, 0x1a, 0x08, 0xf6, 0xfd, 0x37, 0x04,
|
|
||||||
};
|
|
||||||
const uint8_t* const _I_gun_inv[] = {_I_gun_inv_0};
|
|
||||||
|
|
||||||
const uint8_t _I_gun_mask_inv_0[] = {
|
|
||||||
0x01, 0x00, 0x53, 0x00, 0x00, 0x0c, 0x38, 0x04, 0x38, 0x09, 0xf8, 0x0c, 0x78, 0x17, 0xf0,
|
|
||||||
0x18, 0xf8, 0x00, 0x67, 0xff, 0x01, 0xaf, 0xc3, 0xff, 0x01, 0x80, 0x7e, 0x3f, 0xf0, 0x38,
|
|
||||||
0x07, 0xf0, 0x0e, 0x40, 0x31, 0x03, 0x8f, 0xfb, 0xff, 0x07, 0x01, 0x94, 0x3c, 0x0e, 0xc0,
|
|
||||||
0x35, 0xff, 0x85, 0xc8, 0x06, 0x30, 0x7e, 0x00, 0x0c, 0x61, 0xe2, 0xe1, 0xff, 0xc7, 0xc5,
|
|
||||||
0xc3, 0xff, 0x9f, 0x80, 0xca, 0xfe, 0x03, 0x2f, 0xf8, 0x0c, 0xc6, 0xc2, 0x03, 0x4b, 0xf8,
|
|
||||||
0xa8, 0x42, 0xe2, 0x03, 0x28, 0xf8, 0x1e, 0x80, 0x68, 0x1e, 0x28, 0x78,
|
|
||||||
};
|
|
||||||
const uint8_t* const _I_gun_mask_inv[] = {_I_gun_mask_inv_0};
|
|
||||||
|
|
||||||
const uint8_t _I_logo_inv_0[] = {
|
|
||||||
0x01, 0x00, 0x92, 0x01, 0x00, 0x78, 0x03, 0xc0, 0x03, 0xfc, 0xff, 0xff, 0xfc, 0x1f, 0xf9, 0xff,
|
|
||||||
0xe3, 0xff, 0x0f, 0x8f, 0xfc, 0x2f, 0xe0, 0xf3, 0xdc, 0x6e, 0xf7, 0x7b, 0x1d, 0xdd, 0xef, 0x79,
|
|
||||||
0xbb, 0xcd, 0xce, 0xf7, 0x13, 0xb0, 0x79, 0xfc, 0x03, 0xe3, 0xfb, 0x01, 0x0f, 0xfb, 0xff, 0xbf,
|
|
||||||
0x11, 0x8c, 0x7c, 0x1e, 0x7e, 0x0f, 0x77, 0xbb, 0xd4, 0x02, 0x10, 0x00, 0xeb, 0xad, 0xde, 0xc8,
|
|
||||||
0x70, 0x3c, 0xf8, 0x01, 0xf7, 0xbf, 0xff, 0x20, 0xe0, 0xf3, 0xc0, 0x6e, 0x80, 0x0d, 0x7a, 0xde,
|
|
||||||
0x40, 0x83, 0xf8, 0x03, 0x10, 0xfa, 0x70, 0x07, 0xee, 0x02, 0x18, 0x30, 0x3d, 0x0a, 0xe3, 0xfb,
|
|
||||||
0x83, 0x86, 0xc7, 0x82, 0x1f, 0x1f, 0xf8, 0xfd, 0x61, 0x5a, 0x0d, 0x54, 0x0b, 0x55, 0xaa, 0xc0,
|
|
||||||
0x00, 0x84, 0x0c, 0x21, 0xf4, 0x8f, 0xf4, 0x3b, 0x70, 0x3e, 0xf7, 0x7b, 0x01, 0x9f, 0xef, 0xf7,
|
|
||||||
0xc3, 0xfe, 0x1f, 0x6f, 0x87, 0xee, 0x07, 0xfe, 0xff, 0x60, 0x07, 0xfe, 0x1f, 0x88, 0xef, 0xc3,
|
|
||||||
0xf3, 0x01, 0xfe, 0x7f, 0x30, 0x1b, 0xdf, 0xef, 0xf6, 0x0a, 0x1f, 0xf0, 0x79, 0xd0, 0x22, 0xf7,
|
|
||||||
0x0b, 0x9c, 0x0e, 0xed, 0x76, 0x80, 0x4d, 0xee, 0xf7, 0x71, 0xff, 0x87, 0xd6, 0x2b, 0x50, 0xa8,
|
|
||||||
0xc0, 0x6a, 0x95, 0x48, 0x04, 0x56, 0xab, 0x55, 0x1f, 0xf8, 0xff, 0xc7, 0xfe, 0x3f, 0xaa, 0xe4,
|
|
||||||
0x02, 0x3b, 0x55, 0xae, 0x8f, 0xfc, 0xbf, 0xe1, 0xff, 0x0f, 0xf8, 0x7d, 0x61, 0x18, 0x0c, 0x44,
|
|
||||||
0x03, 0x11, 0x88, 0x02, 0x0e, 0x23, 0x04, 0x0e, 0x30, 0xfa, 0x41, 0x43, 0xe2, 0x06, 0x18, 0xa8,
|
|
||||||
0x18, 0x43, 0xe9, 0x02, 0xd0, 0x68, 0xa1, 0x5a, 0x2d, 0x51, 0x10, 0x70, 0x5a, 0x21, 0xfc, 0x45,
|
|
||||||
0x43, 0xe3, 0x50, 0x0f, 0xc4, 0x20, 0x72, 0x20, 0x22, 0x02, 0x16, 0x00, 0x7e, 0xd5, 0x4a, 0x8d,
|
|
||||||
0x54, 0x3e, 0x35, 0x40, 0xfb, 0x80, 0x3c, 0x3e, 0x35, 0x5a, 0x09, 0xe8, 0x6a, 0x87, 0xc1, 0x23,
|
|
||||||
0x88, 0xfd, 0x40, 0x0c, 0x09, 0x20, 0xfa, 0x87, 0x06, 0x00, 0x1f, 0x38, 0x0c, 0x50, 0x3e, 0xa0,
|
|
||||||
0x0f, 0x0f, 0x8c, 0x56, 0x00, 0x5c, 0x1a, 0x80, 0x90, 0x62, 0x03, 0xf6, 0x80, 0x42, 0x17, 0xc2,
|
|
||||||
0x7b, 0x10, 0x20, 0x87, 0xde, 0xa9, 0x04, 0x80, 0x54, 0x20, 0x94, 0x08, 0xa0, 0x24, 0x47, 0xf5,
|
|
||||||
0x01, 0x20, 0x54, 0x44, 0x18, 0x80, 0x42, 0x88, 0x17, 0xfc, 0x7e, 0xb4, 0x40, 0x4c, 0x12, 0x04,
|
|
||||||
0x01, 0xe3, 0xf4, 0x2a, 0xf8, 0x03, 0xc0, 0x1f, 0xe0, 0xbc, 0xcf, 0xb8, 0xf8, 0x1e, 0xbf, 0xcc,
|
|
||||||
0x5b, 0x12, 0x0c, 0x56, 0x0a, 0x51, 0x82, 0xa8, 0x28, 0x08, 0x1f, 0x32, 0x0c, 0x00, 0x3e, 0x85,
|
|
||||||
0xe3, 0x1e, 0x17, 0x8f, 0x4f, 0xe6, 0x1f, 0x99, 0x44, 0x0a, 0x10, 0x2f, 0x13, 0xb4, 0xc8, 0x29,
|
|
||||||
0x03, 0xf3, 0x89, 0x03, 0xe7, 0x10, 0x5f, 0x2a, 0x87, 0xd1, 0x1b, 0xe0, 0x0f, 0x00, 0x78, 0x03,
|
|
||||||
0xc0, 0x1e, 0x00, 0xf0, 0x02, 0x00,
|
|
||||||
};
|
|
||||||
const uint8_t* const _I_logo_inv[] = {_I_logo_inv_0};
|
|
||||||
|
|
||||||
const Icon I_fire_inv =
|
|
||||||
{.width = 24, .height = 20, .frame_count = 1, .frame_rate = 0, .frames = _I_fire_inv};
|
|
||||||
const Icon I_gun_inv =
|
|
||||||
{.width = 32, .height = 32, .frame_count = 1, .frame_rate = 0, .frames = _I_gun_inv};
|
|
||||||
const Icon I_gun_mask_inv =
|
|
||||||
{.width = 32, .height = 32, .frame_count = 1, .frame_rate = 0, .frames = _I_gun_mask_inv};
|
|
||||||
const Icon I_logo_inv =
|
|
||||||
{.width = 128, .height = 64, .frame_count = 1, .frame_rate = 0, .frames = _I_logo_inv};
|
|
||||||
|
|
||||||
const uint8_t space[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
const uint8_t space[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
const uint8_t zero[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
|
const uint8_t zero[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
|
@ -41,12 +41,6 @@
|
|||||||
#define GRADIENT_WHITE 7
|
#define GRADIENT_WHITE 7
|
||||||
#define GRADIENT_BLACK 0
|
#define GRADIENT_BLACK 0
|
||||||
|
|
||||||
// Inverted icons
|
|
||||||
extern const Icon I_fire_inv;
|
|
||||||
extern const Icon I_gun_inv;
|
|
||||||
extern const Icon I_gun_mask_inv;
|
|
||||||
extern const Icon I_logo_inv;
|
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
extern const uint8_t zero[];
|
extern const uint8_t zero[];
|
||||||
extern const uint8_t one[];
|
extern const uint8_t one[];
|
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2.3 MiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2.3 MiB |
26
applications/external/doom/display.h
vendored
@ -1,9 +1,8 @@
|
|||||||
#include <gui/gui.h>
|
#include <gui/gui.h>
|
||||||
#include <gui/canvas_i.h>
|
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
#include <u8g2_glue.h>
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "compiled/assets_icons.h"
|
#include <doom_icons.h>
|
||||||
|
#include "assets.h"
|
||||||
|
|
||||||
#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
|
#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
|
||||||
|
|
||||||
@ -50,14 +49,12 @@ void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas);
|
|||||||
bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i);
|
bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i);
|
||||||
double getActualFps();
|
double getActualFps();
|
||||||
void fps();
|
void fps();
|
||||||
void setupDisplay(Canvas* canvas);
|
|
||||||
uint8_t reverse_bits(uint8_t num);
|
uint8_t reverse_bits(uint8_t num);
|
||||||
|
|
||||||
// FPS control
|
// FPS control
|
||||||
double delta = 1;
|
double delta = 1;
|
||||||
uint32_t lastFrameTime = 0;
|
uint32_t lastFrameTime = 0;
|
||||||
uint8_t zbuffer[128]; /// 128 = screen width & REMOVE WHEN DISPLAY.H IMPLEMENTED
|
uint8_t zbuffer[128]; /// 128 = screen width & REMOVE WHEN DISPLAY.H IMPLEMENTED
|
||||||
uint8_t* display_buf = NULL;
|
|
||||||
|
|
||||||
void drawGun(
|
void drawGun(
|
||||||
int16_t x,
|
int16_t x,
|
||||||
@ -88,12 +85,6 @@ void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canva
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupDisplay(Canvas* canvas) {
|
|
||||||
memset(zbuffer, 0xff, 128);
|
|
||||||
display_buf = (uint8_t*)canvas->fb.tile_buf_ptr;
|
|
||||||
//display_buf = u8g2_GetBufferPtr(&canvas->fb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawBitmap(
|
void drawBitmap(
|
||||||
int16_t x,
|
int16_t x,
|
||||||
int16_t y,
|
int16_t y,
|
||||||
@ -102,13 +93,20 @@ void drawBitmap(
|
|||||||
int16_t h,
|
int16_t h,
|
||||||
uint16_t color,
|
uint16_t color,
|
||||||
Canvas* const canvas) {
|
Canvas* const canvas) {
|
||||||
UNUSED(color);
|
UNUSED(w);
|
||||||
canvas_draw_icon_bitmap(canvas, x, y, w, h, i);
|
UNUSED(h);
|
||||||
|
if(!color) {
|
||||||
|
canvas_invert_color(canvas);
|
||||||
|
}
|
||||||
|
canvas_draw_icon(canvas, x, y, i);
|
||||||
|
if(!color) {
|
||||||
|
canvas_invert_color(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas) {
|
void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas) {
|
||||||
char buf[4];
|
char buf[4];
|
||||||
itoa(num, buf, 10);
|
snprintf(buf, 4, "%d", num);
|
||||||
drawTextSpace(x, y, buf, 1, canvas);
|
drawTextSpace(x, y, buf, 1, canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
applications/external/doom/doom.c
vendored
@ -6,7 +6,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "compiled/assets_icons.h"
|
#include "assets.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "entities.h"
|
#include "entities.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@ -226,8 +226,8 @@ UID detectCollision(
|
|||||||
bool only_walls,
|
bool only_walls,
|
||||||
PluginState* const plugin_state) {
|
PluginState* const plugin_state) {
|
||||||
// Wall collision
|
// Wall collision
|
||||||
uint8_t round_x = (int)pos->x + (int)relative_x;
|
uint8_t round_x = (int)(pos->x + relative_x);
|
||||||
uint8_t round_y = (int)pos->y + (int)relative_y;
|
uint8_t round_y = (int)(pos->y + relative_y);
|
||||||
uint8_t block = getBlockAt(level, round_x, round_y);
|
uint8_t block = getBlockAt(level, round_x, round_y);
|
||||||
|
|
||||||
if(block == E_WALL) {
|
if(block == E_WALL) {
|
||||||
@ -769,7 +769,6 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
|||||||
furi_assert(ctx);
|
furi_assert(ctx);
|
||||||
PluginState* plugin_state = ctx;
|
PluginState* plugin_state = ctx;
|
||||||
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
|
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
|
||||||
if(plugin_state->init) setupDisplay(canvas);
|
|
||||||
|
|
||||||
canvas_set_font(canvas, FontPrimary);
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
|
||||||
@ -855,7 +854,6 @@ static void doom_game_update_timer_callback(FuriMessageQueue* event_queue) {
|
|||||||
static void doom_game_tick(PluginState* const plugin_state) {
|
static void doom_game_tick(PluginState* const plugin_state) {
|
||||||
if(plugin_state->scene == GAME_PLAY) {
|
if(plugin_state->scene == GAME_PLAY) {
|
||||||
//fps();
|
//fps();
|
||||||
memset(display_buf, 0, SCREEN_WIDTH * (RENDER_HEIGHT / 8));
|
|
||||||
//player is alive
|
//player is alive
|
||||||
if(plugin_state->player.health > 0) {
|
if(plugin_state->player.health > 0) {
|
||||||
if(plugin_state->up) {
|
if(plugin_state->up) {
|
||||||
@ -983,7 +981,7 @@ int32_t doom_app() {
|
|||||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
if(display_buf != NULL) plugin_state->init = false;
|
plugin_state->init = false;
|
||||||
|
|
||||||
PluginEvent event;
|
PluginEvent event;
|
||||||
#ifdef SOUND
|
#ifdef SOUND
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -6,9 +6,9 @@ App(
|
|||||||
requires=[
|
requires=[
|
||||||
"gui",
|
"gui",
|
||||||
],
|
],
|
||||||
stack_size=1 * 1024,
|
stack_size= 4 * 1024,
|
||||||
order=90,
|
order=90,
|
||||||
fap_version=(1, 1),
|
fap_version=(1, 2),
|
||||||
fap_icon="lightmeter.png",
|
fap_icon="lightmeter.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_private_libs=[
|
fap_private_libs=[
|
||||||
|
17
applications/external/lightmeter/docs/README.md
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
## Lightmeter app for photography
|
||||||
|
|
||||||
|
An application that suggests settings for your manual camera based on the reading of the ambient light sensor. Can also be used in a pure lux meter mode.
|
||||||
|
|
||||||
|
## Supported sensors
|
||||||
|
|
||||||
|
- BH1750
|
||||||
|
- MAX44009
|
||||||
|
|
||||||
|
## Wiring
|
||||||
|
|
||||||
|
| Sensor | Flipper Zero |
|
||||||
|
| ------ | ------------ |
|
||||||
|
| VCC | 3.3V |
|
||||||
|
| GND | GND |
|
||||||
|
| SCL | C0 |
|
||||||
|
| SDA | C1 |
|
15
applications/external/lightmeter/docs/changelog.md
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
## v1.2
|
||||||
|
|
||||||
|
* Lux only screen now has statistics
|
||||||
|
* Settings are now stored on SD card
|
||||||
|
* You can choose the resolution (BH1750 only) and address for sensor
|
||||||
|
|
||||||
|
(thanks to @danielskowronski for contributing to this update)
|
||||||
|
|
||||||
|
## v1.1
|
||||||
|
|
||||||
|
Added support for MAX44009 sensor (thanks to @wosk)
|
||||||
|
|
||||||
|
## v1.0
|
||||||
|
|
||||||
|
Initial release for Flipper Application Catalog
|
@ -56,6 +56,22 @@ static const char* sensor_type[] = {
|
|||||||
[SENSOR_MAX44009] = "MAX44009",
|
[SENSOR_MAX44009] = "MAX44009",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char* measurement_resolution[] = {
|
||||||
|
[LOW_RES] = "Low",
|
||||||
|
[HIGH_RES] = "High",
|
||||||
|
[HIGH_RES2] = "High2",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* device_addr_bh1750[] = {
|
||||||
|
[ADDR_LOW] = "0x23",
|
||||||
|
[ADDR_HIGH] = "0x5C",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* device_addr_max44009[] = {
|
||||||
|
[ADDR_LOW] = "0x4A",
|
||||||
|
[ADDR_HIGH] = "0x4B",
|
||||||
|
};
|
||||||
|
|
||||||
enum LightMeterSubmenuIndex {
|
enum LightMeterSubmenuIndex {
|
||||||
LightMeterSubmenuIndexISO,
|
LightMeterSubmenuIndexISO,
|
||||||
LightMeterSubmenuIndexND,
|
LightMeterSubmenuIndexND,
|
||||||
@ -63,6 +79,8 @@ enum LightMeterSubmenuIndex {
|
|||||||
LightMeterSubmenuIndexBacklight,
|
LightMeterSubmenuIndexBacklight,
|
||||||
LightMeterSubmenuIndexLuxMeter,
|
LightMeterSubmenuIndexLuxMeter,
|
||||||
LightMeterSubmenuIndexSensorType,
|
LightMeterSubmenuIndexSensorType,
|
||||||
|
LightMeterSubmenuIndexMeasurementResolution,
|
||||||
|
LightMeterSubmenuIndexI2CAddress,
|
||||||
LightMeterSubmenuIndexHelp,
|
LightMeterSubmenuIndexHelp,
|
||||||
LightMeterSubmenuIndexAbout,
|
LightMeterSubmenuIndexAbout,
|
||||||
};
|
};
|
||||||
@ -133,6 +151,60 @@ static void lux_only_cb(VariableItem* item) {
|
|||||||
lightmeter_app_set_config(app, config);
|
lightmeter_app_set_config(app, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void measurement_resolution_cb(VariableItem* item) {
|
||||||
|
LightMeterApp* app = variable_item_get_context(item);
|
||||||
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
|
variable_item_set_current_value_text(item, measurement_resolution[index]);
|
||||||
|
|
||||||
|
LightMeterConfig* config = app->config;
|
||||||
|
config->measurement_resolution = index;
|
||||||
|
lightmeter_app_set_config(app, config);
|
||||||
|
|
||||||
|
lightmeter_app_i2c_init_sensor(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_item_addr(LightMeterApp* app) {
|
||||||
|
VariableItem* item = app->var_item_addr;
|
||||||
|
switch(app->config->sensor_type) {
|
||||||
|
case SENSOR_BH1750:
|
||||||
|
variable_item_set_current_value_index(item, app->config->device_addr);
|
||||||
|
variable_item_set_current_value_text(item, device_addr_bh1750[app->config->device_addr]);
|
||||||
|
break;
|
||||||
|
case SENSOR_MAX44009:
|
||||||
|
variable_item_set_current_value_index(item, app->config->device_addr);
|
||||||
|
variable_item_set_current_value_text(item, device_addr_max44009[app->config->device_addr]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FURI_LOG_E(TAG, "Invalid sensor type %ld", app->config->sensor_type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void device_addr_cb(VariableItem* item) {
|
||||||
|
LightMeterApp* app = variable_item_get_context(item);
|
||||||
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
|
switch(app->config->sensor_type) {
|
||||||
|
case SENSOR_BH1750:
|
||||||
|
variable_item_set_current_value_text(item, device_addr_bh1750[index]);
|
||||||
|
break;
|
||||||
|
case SENSOR_MAX44009:
|
||||||
|
variable_item_set_current_value_text(item, device_addr_max44009[index]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FURI_LOG_E(TAG, "Invalid sensor type %ld", app->config->sensor_type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// variable_item_set_current_value_text(item, device_addr[index]);
|
||||||
|
|
||||||
|
LightMeterConfig* config = app->config;
|
||||||
|
config->device_addr = index;
|
||||||
|
lightmeter_app_set_config(app, config);
|
||||||
|
|
||||||
|
lightmeter_app_i2c_init_sensor(app);
|
||||||
|
}
|
||||||
|
|
||||||
static void sensor_type_cb(VariableItem* item) {
|
static void sensor_type_cb(VariableItem* item) {
|
||||||
LightMeterApp* app = variable_item_get_context(item);
|
LightMeterApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
@ -141,6 +213,9 @@ static void sensor_type_cb(VariableItem* item) {
|
|||||||
|
|
||||||
LightMeterConfig* config = app->config;
|
LightMeterConfig* config = app->config;
|
||||||
config->sensor_type = index;
|
config->sensor_type = index;
|
||||||
|
|
||||||
|
update_item_addr(app);
|
||||||
|
|
||||||
lightmeter_app_set_config(app, config);
|
lightmeter_app_set_config(app, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +270,36 @@ void lightmeter_scene_config_on_enter(void* context) {
|
|||||||
variable_item_set_current_value_index(item, config->sensor_type);
|
variable_item_set_current_value_index(item, config->sensor_type);
|
||||||
variable_item_set_current_value_text(item, sensor_type[config->sensor_type]);
|
variable_item_set_current_value_text(item, sensor_type[config->sensor_type]);
|
||||||
|
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list,
|
||||||
|
"Resolution",
|
||||||
|
COUNT_OF(measurement_resolution),
|
||||||
|
measurement_resolution_cb,
|
||||||
|
app);
|
||||||
|
variable_item_set_current_value_index(item, config->measurement_resolution);
|
||||||
|
variable_item_set_current_value_text(
|
||||||
|
item, measurement_resolution[config->measurement_resolution]);
|
||||||
|
|
||||||
|
switch(config->sensor_type) {
|
||||||
|
case SENSOR_BH1750:
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list, "I2C address", COUNT_OF(device_addr_bh1750), device_addr_cb, app);
|
||||||
|
variable_item_set_current_value_index(item, config->device_addr);
|
||||||
|
variable_item_set_current_value_text(item, device_addr_bh1750[config->device_addr]);
|
||||||
|
break;
|
||||||
|
case SENSOR_MAX44009:
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list, "I2C address", COUNT_OF(device_addr_max44009), device_addr_cb, app);
|
||||||
|
variable_item_set_current_value_index(item, config->device_addr);
|
||||||
|
variable_item_set_current_value_text(item, device_addr_max44009[config->device_addr]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FURI_LOG_E(TAG, "Invalid sensor type %ld", config->sensor_type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
app->var_item_addr = item;
|
||||||
|
update_item_addr(app);
|
||||||
|
|
||||||
item = variable_item_list_add(var_item_list, "Help and Pinout", 0, NULL, NULL);
|
item = variable_item_list_add(var_item_list, "Help and Pinout", 0, NULL, NULL);
|
||||||
item = variable_item_list_add(var_item_list, "About", 0, NULL, NULL);
|
item = variable_item_list_add(var_item_list, "About", 0, NULL, NULL);
|
||||||
|
|
||||||
@ -235,4 +340,5 @@ void lightmeter_scene_config_on_exit(void* context) {
|
|||||||
main_view_set_nd(app->main_view, app->config->nd);
|
main_view_set_nd(app->main_view, app->config->nd);
|
||||||
main_view_set_dome(app->main_view, app->config->dome);
|
main_view_set_dome(app->main_view, app->config->dome);
|
||||||
main_view_set_lux_only(app->main_view, app->config->lux_only);
|
main_view_set_lux_only(app->main_view, app->config->lux_only);
|
||||||
|
main_view_set_measurement_resolution(app->main_view, app->config->measurement_resolution);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ void lightmeter_scene_help_on_enter(void* context) {
|
|||||||
temp_str = furi_string_alloc();
|
temp_str = furi_string_alloc();
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
temp_str,
|
temp_str,
|
||||||
"App works with BH1750 and MAX44409 ambient light sensor connected via I2C interface\n\n");
|
"App works with BH1750/MAX44009\nambient light sensor\nconnected via I2C interface\n\n");
|
||||||
furi_string_cat(temp_str, "\e#Pinout:\r\n");
|
furi_string_cat(temp_str, "\e#Pinout:\r\n");
|
||||||
furi_string_cat(
|
furi_string_cat(
|
||||||
temp_str,
|
temp_str,
|
||||||
@ -15,6 +15,12 @@ void lightmeter_scene_help_on_enter(void* context) {
|
|||||||
" GND: GND\r\n"
|
" GND: GND\r\n"
|
||||||
" SDA: 15 [C1]\r\n"
|
" SDA: 15 [C1]\r\n"
|
||||||
" SCL: 16 [C0]\r\n");
|
" SCL: 16 [C0]\r\n");
|
||||||
|
furi_string_cat(temp_str, "\r\n\e#Resolutions:\r\n");
|
||||||
|
furi_string_cat(
|
||||||
|
temp_str,
|
||||||
|
"Low: 4.0lx (16ms, 0-54k)\r\n"
|
||||||
|
"High: 1.0lx (120ms, 0-54k)\r\n"
|
||||||
|
"High2: 0.5lx (120ms, 0-27k)\r\n");
|
||||||
|
|
||||||
widget_add_text_scroll_element(app->widget, 0, 0, 128, 64, furi_string_get_cstr(temp_str));
|
widget_add_text_scroll_element(app->widget, 0, 0, 128, 64, furi_string_get_cstr(temp_str));
|
||||||
furi_string_free(temp_str);
|
furi_string_free(temp_str);
|
||||||
|
@ -6,11 +6,24 @@ static void lightmeter_scene_main_on_left(void* context) {
|
|||||||
view_dispatcher_send_custom_event(app->view_dispatcher, LightMeterAppCustomEventConfig);
|
view_dispatcher_send_custom_event(app->view_dispatcher, LightMeterAppCustomEventConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lightmeter_scene_main_on_right(void* context) {
|
||||||
|
LightMeterApp* app = context;
|
||||||
|
|
||||||
|
view_dispatcher_send_custom_event(app->view_dispatcher, LightMeterAppCustomEventReset);
|
||||||
|
}
|
||||||
|
|
||||||
void lightmeter_scene_main_on_enter(void* context) {
|
void lightmeter_scene_main_on_enter(void* context) {
|
||||||
LightMeterApp* app = context;
|
LightMeterApp* app = context;
|
||||||
|
|
||||||
lightmeter_app_i2c_init_sensor(context);
|
variable_item_list_reset(app->var_item_list);
|
||||||
|
main_view_set_iso(app->main_view, app->config->iso);
|
||||||
|
main_view_set_nd(app->main_view, app->config->nd);
|
||||||
|
main_view_set_dome(app->main_view, app->config->dome);
|
||||||
|
main_view_set_lux_only(app->main_view, app->config->lux_only);
|
||||||
|
main_view_set_measurement_resolution(app->main_view, app->config->measurement_resolution);
|
||||||
|
|
||||||
lightmeter_main_view_set_left_callback(app->main_view, lightmeter_scene_main_on_left, app);
|
lightmeter_main_view_set_left_callback(app->main_view, lightmeter_scene_main_on_left, app);
|
||||||
|
lightmeter_main_view_set_right_callback(app->main_view, lightmeter_scene_main_on_right, app);
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, LightMeterAppViewMainView);
|
view_dispatcher_switch_to_view(app->view_dispatcher, LightMeterAppViewMainView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +37,9 @@ bool lightmeter_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||||||
if(event.event == LightMeterAppCustomEventConfig) {
|
if(event.event == LightMeterAppCustomEventConfig) {
|
||||||
scene_manager_next_scene(app->scene_manager, LightMeterAppSceneConfig);
|
scene_manager_next_scene(app->scene_manager, LightMeterAppSceneConfig);
|
||||||
response = true;
|
response = true;
|
||||||
|
} else if(event.event == LightMeterAppCustomEventReset) {
|
||||||
|
lightmeter_app_reset_callback(app);
|
||||||
|
response = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -40,5 +56,5 @@ bool lightmeter_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lightmeter_scene_main_on_exit(void* context) {
|
void lightmeter_scene_main_on_exit(void* context) {
|
||||||
lightmeter_app_i2c_deinit_sensor(context);
|
UNUSED(context);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "main_view.h"
|
#include "main_view.h"
|
||||||
|
#include <math.h>
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
#include <gui/elements.h>
|
#include <gui/elements.h>
|
||||||
@ -72,6 +73,7 @@ const float speed_numbers[] = {
|
|||||||
struct MainView {
|
struct MainView {
|
||||||
View* view;
|
View* view;
|
||||||
LightMeterMainViewButtonCallback cb_left;
|
LightMeterMainViewButtonCallback cb_left;
|
||||||
|
LightMeterMainViewButtonCallback cb_right;
|
||||||
void* cb_context;
|
void* cb_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,6 +92,21 @@ void lightmeter_main_view_set_left_callback(
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lightmeter_main_view_set_right_callback(
|
||||||
|
MainView* lightmeter_main_view,
|
||||||
|
LightMeterMainViewButtonCallback callback,
|
||||||
|
void* context) {
|
||||||
|
with_view_model(
|
||||||
|
lightmeter_main_view->view,
|
||||||
|
MainViewModel * model,
|
||||||
|
{
|
||||||
|
UNUSED(model);
|
||||||
|
lightmeter_main_view->cb_right = callback;
|
||||||
|
lightmeter_main_view->cb_context = context;
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
static void main_view_draw_callback(Canvas* canvas, void* context) {
|
static void main_view_draw_callback(Canvas* canvas, void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
MainViewModel* model = context;
|
MainViewModel* model = context;
|
||||||
@ -125,6 +142,7 @@ static void main_view_draw_callback(Canvas* canvas, void* context) {
|
|||||||
// draw mode indicator
|
// draw mode indicator
|
||||||
draw_mode_indicator(canvas, model);
|
draw_mode_indicator(canvas, model);
|
||||||
} else {
|
} else {
|
||||||
|
elements_button_right(canvas, "Reset");
|
||||||
draw_lux_only_mode(canvas, model);
|
draw_lux_only_mode(canvas, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,6 +208,11 @@ static bool main_view_input_callback(InputEvent* event, void* context) {
|
|||||||
main_view->cb_left(main_view->cb_context);
|
main_view->cb_left(main_view->cb_context);
|
||||||
}
|
}
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
} else if(event->type == InputTypeShort && event->key == InputKeyRight) {
|
||||||
|
if(main_view->cb_right) {
|
||||||
|
main_view->cb_right(main_view->cb_context);
|
||||||
|
}
|
||||||
|
consumed = true;
|
||||||
} else if(event->type == InputTypeShort && event->key == InputKeyBack) {
|
} else if(event->type == InputTypeShort && event->key == InputKeyBack) {
|
||||||
} else {
|
} else {
|
||||||
main_view_process(main_view, event);
|
main_view_process(main_view, event);
|
||||||
@ -224,7 +247,22 @@ View* main_view_get_view(MainView* main_view) {
|
|||||||
void main_view_set_lux(MainView* main_view, float val) {
|
void main_view_set_lux(MainView* main_view, float val) {
|
||||||
furi_assert(main_view);
|
furi_assert(main_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
main_view->view, MainViewModel * model, { model->lux = val; }, true);
|
main_view->view,
|
||||||
|
MainViewModel * model,
|
||||||
|
{
|
||||||
|
model->lux = val;
|
||||||
|
model->peakLux = fmax(model->peakLux, val);
|
||||||
|
|
||||||
|
model->luxHistogram[model->luxHistogramIndex++] = val;
|
||||||
|
model->luxHistogramIndex %= LUX_HISTORGRAM_LENGTH;
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_view_reset_lux(MainView* main_view) {
|
||||||
|
furi_assert(main_view);
|
||||||
|
with_view_model(
|
||||||
|
main_view->view, MainViewModel * model, { model->peakLux = 0; }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_view_set_EV(MainView* main_view, float val) {
|
void main_view_set_EV(MainView* main_view, float val) {
|
||||||
@ -275,6 +313,27 @@ void main_view_set_lux_only(MainView* main_view, bool lux_only) {
|
|||||||
main_view->view, MainViewModel * model, { model->lux_only = lux_only; }, true);
|
main_view->view, MainViewModel * model, { model->lux_only = lux_only; }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void main_view_set_measurement_resolution(MainView* main_view, int measurement_resolution) {
|
||||||
|
furi_assert(main_view);
|
||||||
|
with_view_model(
|
||||||
|
main_view->view,
|
||||||
|
MainViewModel * model,
|
||||||
|
{ model->measurement_resolution = measurement_resolution; },
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_view_set_device_addr(MainView* main_view, int device_addr) {
|
||||||
|
furi_assert(main_view);
|
||||||
|
with_view_model(
|
||||||
|
main_view->view, MainViewModel * model, { model->device_addr = device_addr; }, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_view_set_sensor_type(MainView* main_view, int sensor_type) {
|
||||||
|
furi_assert(main_view);
|
||||||
|
with_view_model(
|
||||||
|
main_view->view, MainViewModel * model, { model->sensor_type = sensor_type; }, true);
|
||||||
|
}
|
||||||
|
|
||||||
bool main_view_get_dome(MainView* main_view) {
|
bool main_view_get_dome(MainView* main_view) {
|
||||||
furi_assert(main_view);
|
furi_assert(main_view);
|
||||||
bool val = false;
|
bool val = false;
|
||||||
@ -462,9 +521,28 @@ void draw_lux_only_mode(Canvas* canvas, MainViewModel* context) {
|
|||||||
|
|
||||||
canvas_set_font(canvas, FontBigNumbers);
|
canvas_set_font(canvas, FontBigNumbers);
|
||||||
snprintf(str, sizeof(str), "%.0f", (double)model->lux);
|
snprintf(str, sizeof(str), "%.0f", (double)model->lux);
|
||||||
canvas_draw_str_aligned(canvas, 80, 32, AlignRight, AlignCenter, str);
|
canvas_draw_str_aligned(canvas, 80, 22, AlignRight, AlignCenter, str);
|
||||||
|
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
canvas_draw_str_aligned(canvas, 85, 39, AlignLeft, AlignBottom, "Lux");
|
canvas_draw_str_aligned(canvas, 85, 29, AlignLeft, AlignBottom, "Lux now");
|
||||||
|
|
||||||
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
snprintf(str, sizeof(str), "%.0f", (double)model->peakLux);
|
||||||
|
canvas_draw_str_aligned(canvas, 80, 39, AlignRight, AlignCenter, str);
|
||||||
|
|
||||||
|
canvas_set_font(canvas, FontSecondary);
|
||||||
|
canvas_draw_str_aligned(canvas, 85, 43, AlignLeft, AlignBottom, "Lux peak");
|
||||||
|
|
||||||
|
for(int i = 0; i < LUX_HISTORGRAM_LENGTH; i++) {
|
||||||
|
float lux =
|
||||||
|
model->luxHistogram[(i + model->luxHistogramIndex) % LUX_HISTORGRAM_LENGTH];
|
||||||
|
int barHeight = log10(lux) / log10(LUX_HISTORGRAM_LOGBASE);
|
||||||
|
canvas_draw_line(
|
||||||
|
canvas,
|
||||||
|
LUX_HISTORGRAM_LEFT + i,
|
||||||
|
LUX_HISTORGRAM_BOTTOM,
|
||||||
|
LUX_HISTORGRAM_LEFT + i,
|
||||||
|
LUX_HISTORGRAM_BOTTOM - barHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,18 @@
|
|||||||
#include "lightmeter_icons.h"
|
#include "lightmeter_icons.h"
|
||||||
#include "../../lightmeter_config.h"
|
#include "../../lightmeter_config.h"
|
||||||
|
|
||||||
|
/* log base 1.4 and 12 pixels cut off
|
||||||
|
makes it show values approx 65-65k
|
||||||
|
with reasonable resolution in 1-10k range
|
||||||
|
on 20px of screen height */
|
||||||
|
#define LUX_HISTORGRAM_LOGBASE 1.4
|
||||||
|
#define LUX_HISTORGRAM_BOTTOM 64 + 12
|
||||||
|
|
||||||
|
/* 40 pixels between 45th and 85th
|
||||||
|
between left and right button labels */
|
||||||
|
#define LUX_HISTORGRAM_LEFT 45
|
||||||
|
#define LUX_HISTORGRAM_LENGTH 40
|
||||||
|
|
||||||
typedef struct MainView MainView;
|
typedef struct MainView MainView;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -17,6 +29,7 @@ typedef struct {
|
|||||||
uint8_t recv[2];
|
uint8_t recv[2];
|
||||||
MainViewMode current_mode;
|
MainViewMode current_mode;
|
||||||
float lux;
|
float lux;
|
||||||
|
float peakLux;
|
||||||
float EV;
|
float EV;
|
||||||
float aperture_val;
|
float aperture_val;
|
||||||
float speed_val;
|
float speed_val;
|
||||||
@ -28,6 +41,12 @@ typedef struct {
|
|||||||
int speed;
|
int speed;
|
||||||
bool dome;
|
bool dome;
|
||||||
bool lux_only;
|
bool lux_only;
|
||||||
|
int measurement_resolution;
|
||||||
|
int device_addr;
|
||||||
|
int sensor_type;
|
||||||
|
|
||||||
|
float luxHistogram[LUX_HISTORGRAM_LENGTH];
|
||||||
|
int luxHistogramIndex;
|
||||||
} MainViewModel;
|
} MainViewModel;
|
||||||
|
|
||||||
typedef void (*LightMeterMainViewButtonCallback)(void* context);
|
typedef void (*LightMeterMainViewButtonCallback)(void* context);
|
||||||
@ -37,6 +56,11 @@ void lightmeter_main_view_set_left_callback(
|
|||||||
LightMeterMainViewButtonCallback callback,
|
LightMeterMainViewButtonCallback callback,
|
||||||
void* context);
|
void* context);
|
||||||
|
|
||||||
|
void lightmeter_main_view_set_right_callback(
|
||||||
|
MainView* lightmeter_main_view,
|
||||||
|
LightMeterMainViewButtonCallback callback,
|
||||||
|
void* context);
|
||||||
|
|
||||||
MainView* main_view_alloc();
|
MainView* main_view_alloc();
|
||||||
|
|
||||||
void main_view_free(MainView* main_view);
|
void main_view_free(MainView* main_view);
|
||||||
@ -45,6 +69,8 @@ View* main_view_get_view(MainView* main_view);
|
|||||||
|
|
||||||
void main_view_set_lux(MainView* main_view, float val);
|
void main_view_set_lux(MainView* main_view, float val);
|
||||||
|
|
||||||
|
void main_view_reset_lux(MainView* main_view);
|
||||||
|
|
||||||
void main_view_set_EV(MainView* main_view_, float val);
|
void main_view_set_EV(MainView* main_view_, float val);
|
||||||
|
|
||||||
void main_view_set_response(MainView* main_view_, bool val);
|
void main_view_set_response(MainView* main_view_, bool val);
|
||||||
@ -61,6 +87,12 @@ void main_view_set_dome(MainView* main_view, bool val);
|
|||||||
|
|
||||||
void main_view_set_lux_only(MainView* main_view, bool val);
|
void main_view_set_lux_only(MainView* main_view, bool val);
|
||||||
|
|
||||||
|
void main_view_set_measurement_resolution(MainView* main_view, int val);
|
||||||
|
|
||||||
|
void main_view_set_device_addr(MainView* main_view, int addr);
|
||||||
|
|
||||||
|
void main_view_set_sensor_type(MainView* main_view, int sensor_type);
|
||||||
|
|
||||||
bool main_view_get_dome(MainView* main_view);
|
bool main_view_get_dome(MainView* main_view);
|
||||||
|
|
||||||
void draw_top_row(Canvas* canvas, MainViewModel* context);
|
void draw_top_row(Canvas* canvas, MainViewModel* context);
|
||||||
|
@ -2,13 +2,20 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
|
|
||||||
|
uint8_t max44009_addr = MAX44009_ADDR;
|
||||||
|
|
||||||
void max44009_init() {
|
void max44009_init() {
|
||||||
furi_hal_i2c_acquire(I2C_BUS);
|
furi_hal_i2c_acquire(I2C_BUS);
|
||||||
furi_hal_i2c_write_reg_8(I2C_BUS, MAX44009_ADDR,
|
furi_hal_i2c_write_reg_8(
|
||||||
MAX44009_REG_CONFIG, MAX44009_REG_CONFIG_CONT_MODE, I2C_TIMEOUT);
|
I2C_BUS, max44009_addr, MAX44009_REG_CONFIG, MAX44009_REG_CONFIG_CONT_MODE, I2C_TIMEOUT);
|
||||||
furi_hal_i2c_release(I2C_BUS);
|
furi_hal_i2c_release(I2C_BUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void max44009_init_with_addr(uint8_t addr) {
|
||||||
|
max44009_addr = (addr << 1);
|
||||||
|
return max44009_init();
|
||||||
|
}
|
||||||
|
|
||||||
int max44009_read_light(float* result) {
|
int max44009_read_light(float* result) {
|
||||||
uint8_t data_one = 0;
|
uint8_t data_one = 0;
|
||||||
uint8_t exp, mantissa;
|
uint8_t exp, mantissa;
|
||||||
@ -18,7 +25,8 @@ int max44009_read_light(float* result) {
|
|||||||
furi_hal_i2c_read_reg_8(I2C_BUS, MAX44009_ADDR, MAX44009_REG_LUX_HI, &data_one, I2C_TIMEOUT);
|
furi_hal_i2c_read_reg_8(I2C_BUS, MAX44009_ADDR, MAX44009_REG_LUX_HI, &data_one, I2C_TIMEOUT);
|
||||||
exp = (data_one & MAX44009_REG_LUX_HI_EXP_MASK) >> 4;
|
exp = (data_one & MAX44009_REG_LUX_HI_EXP_MASK) >> 4;
|
||||||
mantissa = (data_one & MAX44009_REG_LUX_HI_MANT_HI_MASK) << 4;
|
mantissa = (data_one & MAX44009_REG_LUX_HI_MANT_HI_MASK) << 4;
|
||||||
status = furi_hal_i2c_read_reg_8(I2C_BUS, MAX44009_ADDR, MAX44009_REG_LUX_LO, &data_one, I2C_TIMEOUT);
|
status = furi_hal_i2c_read_reg_8(
|
||||||
|
I2C_BUS, MAX44009_ADDR, MAX44009_REG_LUX_LO, &data_one, I2C_TIMEOUT);
|
||||||
mantissa |= (data_one & MAX44009_REG_LUX_LO_MANT_LO_MASK);
|
mantissa |= (data_one & MAX44009_REG_LUX_LO_MANT_LO_MASK);
|
||||||
furi_hal_i2c_release(I2C_BUS);
|
furi_hal_i2c_release(I2C_BUS);
|
||||||
*result = (float)pow(2, exp) * mantissa * 0.045;
|
*result = (float)pow(2, exp) * mantissa * 0.045;
|
||||||
|
@ -23,4 +23,5 @@
|
|||||||
#define MAX44009_REG_INT_TIME 0x07
|
#define MAX44009_REG_INT_TIME 0x07
|
||||||
|
|
||||||
void max44009_init();
|
void max44009_init();
|
||||||
|
void max44009_init_with_addr(uint8_t addr);
|
||||||
int max44009_read_light(float* result);
|
int max44009_read_light(float* result);
|
||||||
|
79
applications/external/lightmeter/lightmeter.c
vendored
@ -34,11 +34,35 @@ LightMeterApp* lightmeter_app_alloc(uint32_t first_scene) {
|
|||||||
app->config->aperture = DEFAULT_APERTURE;
|
app->config->aperture = DEFAULT_APERTURE;
|
||||||
app->config->dome = DEFAULT_DOME;
|
app->config->dome = DEFAULT_DOME;
|
||||||
app->config->backlight = DEFAULT_BACKLIGHT;
|
app->config->backlight = DEFAULT_BACKLIGHT;
|
||||||
|
app->config->measurement_resolution = HIGH_RES;
|
||||||
|
app->config->device_addr = ADDR_LOW;
|
||||||
|
app->config->lux_only = LUX_ONLY_OFF;
|
||||||
|
|
||||||
// Records
|
// Records
|
||||||
app->gui = furi_record_open(RECORD_GUI);
|
app->gui = furi_record_open(RECORD_GUI);
|
||||||
|
app->storage = furi_record_open(RECORD_STORAGE);
|
||||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||||
|
|
||||||
|
app->cfg_path = furi_string_alloc();
|
||||||
|
furi_string_printf(app->cfg_path, "%s/%s", APP_PATH_DIR, APP_PATH_CFG);
|
||||||
|
|
||||||
|
FlipperFormat* cfg_fmt = flipper_format_file_alloc(app->storage);
|
||||||
|
if(flipper_format_file_open_existing(cfg_fmt, furi_string_get_cstr(app->cfg_path))) {
|
||||||
|
flipper_format_read_int32(cfg_fmt, "iso", &app->config->iso, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "aperture", &app->config->aperture, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "dome", &app->config->dome, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "backlight", &app->config->backlight, 1);
|
||||||
|
flipper_format_read_int32(
|
||||||
|
cfg_fmt, "measurement_resolution", &app->config->measurement_resolution, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "lux_only", &app->config->lux_only, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "device_addr", &app->config->device_addr, 1);
|
||||||
|
flipper_format_read_int32(cfg_fmt, "sensor_type", &app->config->sensor_type, 1);
|
||||||
|
}
|
||||||
|
flipper_format_free(cfg_fmt);
|
||||||
|
|
||||||
|
// Sensor
|
||||||
|
lightmeter_app_i2c_init_sensor(app);
|
||||||
|
|
||||||
// View dispatcher
|
// View dispatcher
|
||||||
app->view_dispatcher = view_dispatcher_alloc();
|
app->view_dispatcher = view_dispatcher_alloc();
|
||||||
app->scene_manager = scene_manager_alloc(&lightmeter_scene_handlers, app);
|
app->scene_manager = scene_manager_alloc(&lightmeter_scene_handlers, app);
|
||||||
@ -110,8 +134,11 @@ void lightmeter_app_free(LightMeterApp* app) {
|
|||||||
app->notifications,
|
app->notifications,
|
||||||
&sequence_display_backlight_enforce_auto); // set backlight back to auto
|
&sequence_display_backlight_enforce_auto); // set backlight back to auto
|
||||||
}
|
}
|
||||||
|
furi_record_close(RECORD_STORAGE);
|
||||||
furi_record_close(RECORD_NOTIFICATION);
|
furi_record_close(RECORD_NOTIFICATION);
|
||||||
|
|
||||||
|
bh1750_set_power_state(0);
|
||||||
|
|
||||||
free(app->config);
|
free(app->config);
|
||||||
free(app);
|
free(app);
|
||||||
}
|
}
|
||||||
@ -129,6 +156,24 @@ void lightmeter_app_set_config(LightMeterApp* context, LightMeterConfig* config)
|
|||||||
LightMeterApp* app = context;
|
LightMeterApp* app = context;
|
||||||
|
|
||||||
app->config = config;
|
app->config = config;
|
||||||
|
storage_common_mkdir(app->storage, APP_PATH_DIR);
|
||||||
|
|
||||||
|
FlipperFormat* cfg_fmt = flipper_format_file_alloc(app->storage);
|
||||||
|
if(flipper_format_file_open_always(cfg_fmt, furi_string_get_cstr(app->cfg_path))) {
|
||||||
|
flipper_format_write_header_cstr(cfg_fmt, "lightmeter", 1);
|
||||||
|
|
||||||
|
flipper_format_write_int32(cfg_fmt, "iso", &(app->config->iso), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "nd", &(app->config->nd), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "aperture", &(app->config->aperture), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "dome", &(app->config->dome), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "backlight", &(app->config->backlight), 1);
|
||||||
|
flipper_format_write_int32(
|
||||||
|
cfg_fmt, "measurement_resolution", &(app->config->measurement_resolution), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "lux_only", &(app->config->lux_only), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "device_addr", &(app->config->device_addr), 1);
|
||||||
|
flipper_format_write_int32(cfg_fmt, "sensor_type", &(app->config->sensor_type), 1);
|
||||||
|
}
|
||||||
|
flipper_format_free(cfg_fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lightmeter_app_i2c_init_sensor(LightMeterApp* context) {
|
void lightmeter_app_i2c_init_sensor(LightMeterApp* context) {
|
||||||
@ -136,14 +181,34 @@ void lightmeter_app_i2c_init_sensor(LightMeterApp* context) {
|
|||||||
switch(app->config->sensor_type) {
|
switch(app->config->sensor_type) {
|
||||||
case SENSOR_BH1750:
|
case SENSOR_BH1750:
|
||||||
bh1750_set_power_state(1);
|
bh1750_set_power_state(1);
|
||||||
bh1750_init();
|
switch(app->config->device_addr) {
|
||||||
|
case ADDR_HIGH:
|
||||||
|
bh1750_init_with_addr(0x5C);
|
||||||
|
break;
|
||||||
|
case ADDR_LOW:
|
||||||
|
bh1750_init_with_addr(0x23);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bh1750_init_with_addr(0x23);
|
||||||
|
break;
|
||||||
|
}
|
||||||
bh1750_set_mode(ONETIME_HIGH_RES_MODE);
|
bh1750_set_mode(ONETIME_HIGH_RES_MODE);
|
||||||
break;
|
break;
|
||||||
case SENSOR_MAX44009:
|
case SENSOR_MAX44009:
|
||||||
max44009_init();
|
switch(app->config->device_addr) {
|
||||||
|
case ADDR_HIGH:
|
||||||
|
max44009_init_with_addr(0x4B);
|
||||||
|
break;
|
||||||
|
case ADDR_LOW:
|
||||||
|
max44009_init_with_addr(0x4A);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FURI_LOG_E(TAG, "Invalid sensor type %d", app->config->sensor_type);
|
max44009_init_with_addr(0x4A);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FURI_LOG_E(TAG, "Invalid sensor type %ld", app->config->sensor_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +223,7 @@ void lightmeter_app_i2c_deinit_sensor(LightMeterApp* context) {
|
|||||||
// nothing
|
// nothing
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FURI_LOG_E(TAG, "Invalid sensor type %d", app->config->sensor_type);
|
FURI_LOG_E(TAG, "Invalid sensor type %ld", app->config->sensor_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,3 +251,9 @@ void lightmeter_app_i2c_callback(LightMeterApp* context) {
|
|||||||
main_view_set_EV(app->main_view, EV);
|
main_view_set_EV(app->main_view, EV);
|
||||||
main_view_set_response(app->main_view, response);
|
main_view_set_response(app->main_view, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lightmeter_app_reset_callback(LightMeterApp* context) {
|
||||||
|
LightMeterApp* app = context;
|
||||||
|
|
||||||
|
main_view_reset_lux(app->main_view);
|
||||||
|
}
|
||||||
|
31
applications/external/lightmeter/lightmeter.h
vendored
@ -3,6 +3,9 @@
|
|||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
|
|
||||||
|
#include <stream/stream.h>
|
||||||
|
#include <flipper_format/flipper_format_i.h>
|
||||||
|
|
||||||
#include <gui/gui.h>
|
#include <gui/gui.h>
|
||||||
#include <gui/view.h>
|
#include <gui/view.h>
|
||||||
#include <gui/view_dispatcher.h>
|
#include <gui/view_dispatcher.h>
|
||||||
@ -20,14 +23,19 @@
|
|||||||
#include <BH1750.h>
|
#include <BH1750.h>
|
||||||
#include <MAX44009.h>
|
#include <MAX44009.h>
|
||||||
|
|
||||||
|
#define APP_PATH_DIR STORAGE_APP_DATA_PATH_PREFIX
|
||||||
|
#define APP_PATH_CFG "config.txt"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int iso;
|
int32_t iso;
|
||||||
int nd;
|
int32_t nd;
|
||||||
int aperture;
|
int32_t aperture;
|
||||||
int dome;
|
int32_t dome;
|
||||||
int backlight;
|
int32_t backlight;
|
||||||
int lux_only;
|
int32_t lux_only;
|
||||||
int sensor_type;
|
int32_t sensor_type;
|
||||||
|
int32_t measurement_resolution;
|
||||||
|
int32_t device_addr;
|
||||||
} LightMeterConfig;
|
} LightMeterConfig;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -36,9 +44,13 @@ typedef struct {
|
|||||||
ViewDispatcher* view_dispatcher;
|
ViewDispatcher* view_dispatcher;
|
||||||
MainView* main_view;
|
MainView* main_view;
|
||||||
VariableItemList* var_item_list;
|
VariableItemList* var_item_list;
|
||||||
|
VariableItem* var_item_addr;
|
||||||
LightMeterConfig* config;
|
LightMeterConfig* config;
|
||||||
NotificationApp* notifications;
|
NotificationApp* notifications;
|
||||||
Widget* widget;
|
Widget* widget;
|
||||||
|
|
||||||
|
Storage* storage;
|
||||||
|
FuriString* cfg_path;
|
||||||
} LightMeterApp;
|
} LightMeterApp;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -50,6 +62,7 @@ typedef enum {
|
|||||||
} LightMeterAppView;
|
} LightMeterAppView;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
LightMeterAppCustomEventReset,
|
||||||
LightMeterAppCustomEventConfig,
|
LightMeterAppCustomEventConfig,
|
||||||
LightMeterAppCustomEventHelp,
|
LightMeterAppCustomEventHelp,
|
||||||
LightMeterAppCustomEventAbout,
|
LightMeterAppCustomEventAbout,
|
||||||
@ -58,5 +71,9 @@ typedef enum {
|
|||||||
void lightmeter_app_set_config(LightMeterApp* context, LightMeterConfig* config);
|
void lightmeter_app_set_config(LightMeterApp* context, LightMeterConfig* config);
|
||||||
|
|
||||||
void lightmeter_app_i2c_init_sensor(LightMeterApp* context);
|
void lightmeter_app_i2c_init_sensor(LightMeterApp* context);
|
||||||
|
|
||||||
void lightmeter_app_i2c_deinit_sensor(LightMeterApp* context);
|
void lightmeter_app_i2c_deinit_sensor(LightMeterApp* context);
|
||||||
|
|
||||||
void lightmeter_app_i2c_callback(LightMeterApp* context);
|
void lightmeter_app_i2c_callback(LightMeterApp* context);
|
||||||
|
|
||||||
|
void lightmeter_app_reset_callback(LightMeterApp* context);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define LM_VERSION_APP "1.1"
|
#define LM_VERSION_APP "1.2"
|
||||||
#define LM_DEVELOPED "Oleksii Kutuzov"
|
#define LM_DEVELOPED "Oleksii Kutuzov"
|
||||||
#define LM_GITHUB "https://github.com/oleksiikutuzov/flipperzero-lightmeter"
|
#define LM_GITHUB "https://github.com/oleksiikutuzov/flipperzero-lightmeter"
|
||||||
|
|
||||||
@ -105,6 +105,17 @@ typedef enum {
|
|||||||
LUX_ONLY_ON,
|
LUX_ONLY_ON,
|
||||||
} LightMeterLuxOnlyMode;
|
} LightMeterLuxOnlyMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LOW_RES,
|
||||||
|
HIGH_RES,
|
||||||
|
HIGH_RES2,
|
||||||
|
} LightMeterMeterMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ADDR_LOW,
|
||||||
|
ADDR_HIGH,
|
||||||
|
} LightMeterMeterAddr;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SENSOR_BH1750,
|
SENSOR_BH1750,
|
||||||
SENSOR_MAX44009,
|
SENSOR_MAX44009,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <cc1101.h>
|
#include <cc1101_regs.h>
|
||||||
/* ========================== DATA RATE SETTINGS ===============================
|
/* ========================== DATA RATE SETTINGS ===============================
|
||||||
*
|
*
|
||||||
* This is how to configure registers MDMCFG3 and MDMCFG4.
|
* This is how to configure registers MDMCFG3 and MDMCFG4.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* See the LICENSE file for information about the license. */
|
* See the LICENSE file for information about the license. */
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include <cc1101.h>
|
#include <cc1101_regs.h>
|
||||||
|
|
||||||
static void direct_sampling_timer_start(ProtoViewApp* app);
|
static void direct_sampling_timer_start(ProtoViewApp* app);
|
||||||
static void direct_sampling_timer_stop(ProtoViewApp* app);
|
static void direct_sampling_timer_stop(ProtoViewApp* app);
|
||||||
|
@ -8,7 +8,7 @@ App(
|
|||||||
order=12,
|
order=12,
|
||||||
fap_icon="spectrum_10px.png",
|
fap_icon="spectrum_10px.png",
|
||||||
fap_category="Sub-GHz",
|
fap_category="Sub-GHz",
|
||||||
fap_author="@xMasterX & @theY4Kman (original by @jolcese)",
|
fap_author="@xMasterX & @theY4Kman & @ALEEF02 (original by @jolcese)",
|
||||||
fap_version="1.0",
|
fap_version="1.1",
|
||||||
fap_description="Shows received signals on spectrum, not actual analyzer, more like a demo app",
|
fap_description="Displays a spectrogram chart to visually represent RF signals around you.",
|
||||||
)
|
)
|
||||||
|
2
applications/external/subbrute
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a2ca1f4f333b88cbeeecf85fdfb1262d1c5e55b0
|
Subproject commit a2d198782d456f0be3b1da31c28164a5a7f93a7d
|
@ -58,9 +58,9 @@ static void subghz_load_custom_presets(SubGhzSetting* setting) {
|
|||||||
{"FM95",
|
{"FM95",
|
||||||
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
||||||
|
|
||||||
// AM_Q
|
// #2-FSK 200khz BW / 135kHz Filter/ 15.86Khz Deviation + Ramping
|
||||||
{"AM_Q",
|
{"FM15k",
|
||||||
"02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 22 10 1C 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00"},
|
"02 0D 03 47 08 32 0B 06 15 32 14 00 13 00 12 00 11 32 10 A7 18 18 19 1D 1D 92 1C 00 1B 04 20 FB 22 17 21 B6 00 00 00 12 0E 34 60 C5 C1 C0"},
|
||||||
|
|
||||||
// Pagers
|
// Pagers
|
||||||
{"Pagers",
|
{"Pagers",
|
||||||
|
@ -118,6 +118,7 @@ static DialogMessageButton icon2_screen(DialogsApp* dialogs, DialogMessage* mess
|
|||||||
message, furi_hal_version_get_mic_id(), 63, 27, AlignLeft, AlignCenter);
|
message, furi_hal_version_get_mic_id(), 63, 27, AlignLeft, AlignCenter);
|
||||||
result = dialog_message_show(dialogs, message);
|
result = dialog_message_show(dialogs, message);
|
||||||
dialog_message_set_icon(message, NULL, 0, 0);
|
dialog_message_set_icon(message, NULL, 0, 0);
|
||||||
|
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -241,7 +242,7 @@ int32_t about_settings_app(void* p) {
|
|||||||
screen_index--;
|
screen_index--;
|
||||||
}
|
}
|
||||||
} else if(screen_result == DialogMessageButtonRight) {
|
} else if(screen_result == DialogMessageButtonRight) {
|
||||||
if(screen_index < about_screens_count) {
|
if(screen_index < about_screens_count - 1) {
|
||||||
screen_index++;
|
screen_index++;
|
||||||
}
|
}
|
||||||
} else if(screen_result == DialogMessageButtonBack) {
|
} else if(screen_result == DialogMessageButtonBack) {
|
||||||
|
BIN
assets/resources/badusb/assets/layouts/fr-CA.kl
Normal file
@ -1,6 +1,6 @@
|
|||||||
Filetype: IR library file
|
Filetype: IR library file
|
||||||
Version: 1
|
Version: 1
|
||||||
# Last Updated 14th Jul, 2023
|
# Last Updated 24th Jul, 2023
|
||||||
# Last Checked 14th Jul, 2023
|
# Last Checked 14th Jul, 2023
|
||||||
#
|
#
|
||||||
# Model: Electrolux EACM-16 HP/N3
|
# Model: Electrolux EACM-16 HP/N3
|
||||||
@ -769,3 +769,40 @@ type: raw
|
|||||||
frequency: 38000
|
frequency: 38000
|
||||||
duty_cycle: 0.330000
|
duty_cycle: 0.330000
|
||||||
data: 3204 9889 537 1587 491 529 512 544 489 545 489 1573 510 530 511 543 491 552 490 538 511 543 491 543 491 532 509 543 491 1587 489 537 512 543 491 1577 490 543 491 543 491 544 489 543 491 1586 489 544 490 1587 489 539 510 543 491 543 491 1586 490
|
data: 3204 9889 537 1587 491 529 512 544 489 545 489 1573 510 530 511 543 491 552 490 538 511 543 491 543 491 532 509 543 491 1587 489 537 512 543 491 1577 490 543 491 543 491 544 489 543 491 1586 489 544 490 1587 489 539 510 543 491 543 491 1586 490
|
||||||
|
#
|
||||||
|
# Model: Daikin FTXC35DV1B
|
||||||
|
name: Off
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 530 315 532 314 532 314 532 314 532 314 506 340 561 24780 3568 1647 507 1213 535 313 534 340 506 340 506 1212 507 339 507 339 506 339 506 339 506 1214 505 341 504 1215 505 1216 504 343 503 1217 503 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 1219 501 345 501 344 502 345 501 1219 501 1219 501 345 501 344 502 344 502 345 501 344 502 345 501 344 502 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 1219 501 1219 501 345 501 1219 501 345 501 1219 501 1219 501 34807 3563 1652 502 1218 502 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1219 501 344 502 1218 502 1219 501 344 502 1219 501 1218 502 1219 501 1219 501 1219 501 345 501 344 502 1219 501 345 501 344 502 345 501 344 502 344 502 345 501 345 501 345 501 344 502 345 501 345 501 1219 501 345 501 345 501 345 501 345 501 1219 501 345 501 345 501 1219 501 345 501 345 501 1219 501 1219 501 345 501 1219 501 1219 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 345 501 1220 500 346 500 345 501 346 500 346 500 34806 3564 1652 502 1218 502 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 1218 502 344 502 1218 502 1218 502 1218 502 1219 501 1218 502 344 502 345 501 1219 501 345 501 344 502 345 501 344 502 344 502 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 1219 501 345 501 345 501 345 501 346 500 345 501 345 501 345 501 345 501 346 500 346 500 346 500 346 500 346 500 1220 499 346 500 1220 499 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 347 499 346 500 1221 499 1221 499 1221 499 347 499 347 499 347 499 347 499 347 499 347 499 347 499 347 499 347 499 1245 475 1222 498 1245 475 371 475 348 498 348 498 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 372 474 372 474 372 474 371 475 371 475 1246 474 371 475 1246 474 372 474 372 474 372 474 1246 474 1246 474 372 474 371 475 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 1246 474 372 474 1246 474 1246 473 372 474 372 474 1246 474 372 474
|
||||||
|
#
|
||||||
|
name: Dh
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 536 339 507 311 535 312 534 312 534 312 534 339 507 24807 3710 1507 594 1156 563 305 543 304 542 304 570 1126 592 304 515 304 542 304 542 304 542 1155 564 304 541 1158 505 1215 505 342 504 1217 503 1217 503 1218 502 1218 502 1218 502 344 502 343 503 1218 502 343 503 343 503 344 502 344 502 344 502 344 502 344 502 343 503 343 503 344 502 1218 502 344 502 1218 502 344 502 344 502 344 502 1218 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 1218 502 1218 501 344 502 1218 502 344 502 1218 502 1218 502 34800 3564 1651 503 1217 503 343 503 344 502 343 503 1217 503 343 503 343 503 344 502 344 502 1218 502 344 502 1217 503 1218 502 344 502 1218 502 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 1218 502 344 502 344 502 1218 502 1218 502 344 502 1218 502 1219 501 1219 501 345 501 344 502 344 502 344 502 344 502 345 501 345 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 34805 3565 1650 503 1216 503 343 503 343 503 344 502 1217 503 343 503 344 502 343 503 343 503 1217 503 344 502 1218 502 1218 502 344 502 1218 502 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 344 502 1218 502 344 502 1218 501 344 502 344 502 344 502 345 501 344 502 345 501 344 502 345 501 1219 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 346 500 345 501 345 501 346 500 370 476 346 500 346 500 346 500 370 476 346 500 346 500 346 500 346 500 1221 499 1244 476 1244 476 370 476 346 500 370 476 370 476 370 476 370 476 370 476 370 476 370 476 1244 476 1244 476 1244 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 1244 476 370 476 1245 475 370 476 371 475 370 476 1245 475 1245 475 371 475 371 475 370 476 370 476 370 476 370 476 370 476 371 475 370 476 371 475 371 475 371 475 371 475 370 476 371 475 371 475 371 475 1245 475 1245 475 1245 475 371 475 371 475 1245 475 371 475
|
||||||
|
#
|
||||||
|
name: Cool_hi
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 507 340 559 306 487 341 530 315 531 313 561 305 541 24776 3569 1646 508 1212 537 340 506 340 506 340 506 1213 507 339 507 339 506 339 506 340 505 1214 505 341 504 1215 504 1216 503 343 503 1217 502 1218 502 1218 502 1218 502 1218 501 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 344 502 344 502 344 502 1219 501 1218 502 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 1219 501 1219 501 345 501 1219 501 345 501 1219 501 1219 501 34800 3563 1652 502 1217 502 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 1218 501 344 502 1218 502 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 345 501 345 501 344 502 345 501 344 502 345 501 345 501 345 501 344 502 345 501 345 501 1219 501 345 501 345 501 345 501 345 501 1219 501 345 501 1219 501 1219 501 345 501 345 501 1219 501 1219 501 345 501 1219 500 1219 500 1219 500 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 1220 500 346 500 346 500 346 500 346 500 34808 3564 1652 503 1218 502 344 502 344 502 344 502 1218 502 344 502 344 502 345 501 344 502 1218 502 345 501 1218 502 1219 501 344 502 1219 501 1219 501 1219 501 1219 501 1219 501 345 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 500 345 501 345 501 1219 500 1219 501 1219 501 345 501 345 501 345 501 345 501 1219 501 345 501 345 501 1219 501 346 500 346 500 345 501 345 501 346 500 346 500 346 500 345 501 346 500 346 500 346 500 346 500 346 500 346 500 346 500 1220 500 346 500 1220 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 347 499 347 499 346 500 1221 499 1245 475 1221 499 347 499 347 499 347 499 348 498 347 499 348 498 348 498 371 475 348 498 1222 498 1245 475 1245 475 348 498 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 372 474 372 474 372 474 371 475 1245 474 372 474 1246 474 372 474 372 474 372 474 1246 474 1246 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 1246 474 372 474 372 474 372 474 372 474 1247 473 1247 473
|
||||||
|
#
|
||||||
|
name: Cool_lo
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 533 311 535 312 534 312 534 313 533 310 536 312 534 24804 3705 1509 593 1129 590 305 542 305 542 305 569 1127 590 304 514 305 541 304 542 305 541 1155 564 305 540 1157 561 1159 504 341 504 1217 503 1217 503 1217 503 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 344 502 344 502 344 502 1218 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 345 501 1218 502 1218 502 1218 502 344 502 1219 501 345 501 1219 501 1219 501 34806 3565 1650 503 1217 502 343 503 343 503 343 503 1217 503 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 1218 502 344 502 1218 502 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 502 344 502 1219 501 344 502 1218 502 344 502 1219 501 1218 501 345 501 1218 501 1219 501 1218 502 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 1219 501 345 501 345 501 345 501 345 501 34805 3565 1651 503 1217 502 343 503 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 1218 502 344 502 1218 502 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 344 502 1218 502 1219 501 1218 502 345 501 344 502 345 501 1219 501 1219 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 346 500 346 500 345 501 345 501 346 500 346 500 346 500 346 500 346 500 346 500 1220 500 1221 499 1221 498 346 500 346 500 370 476 346 500 347 499 347 499 370 476 370 476 370 476 1244 476 1244 476 1244 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 371 475 370 476 370 476 370 476 371 475 370 476 370 476 370 476 370 476 1244 476 371 475 1245 475 370 476 371 475 371 475 1245 475 1245 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 476 371 475 1245 475 1245 475 371 475 371 475 1246 474 1245 475
|
||||||
|
#
|
||||||
|
name: Heat_lo
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 535 313 533 311 535 311 535 312 534 312 534 313 533 24805 3711 1506 592 1129 592 305 543 305 540 305 569 1126 592 304 514 304 542 304 541 304 485 1213 507 340 506 1214 506 1215 505 342 504 1217 503 1218 502 1218 502 1218 502 1218 502 344 502 344 502 1218 503 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 1218 502 344 502 344 502 344 502 1218 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 503 344 502 1219 501 1219 501 1219 501 345 501 1219 501 345 501 1219 502 1219 502 34818 3566 1651 503 1217 503 343 503 344 502 344 502 1218 502 344 502 344 502 344 502 344 503 1218 502 344 502 1218 503 1218 502 344 502 1218 502 1218 503 1218 503 1218 502 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 1218 502 344 502 345 501 344 502 344 502 1219 501 345 501 345 502 1219 501 345 501 1219 502 1219 502 1219 502 344 502 1219 501 1219 502 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 1219 501 345 501 345 501 345 501 1219 501 345 501 345 501 345 501 34812 3566 1651 503 1217 503 344 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 1218 503 344 502 1218 502 1218 502 344 502 1218 502 1218 502 1218 502 1219 501 1218 502 344 502 344 502 1218 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 344 502 345 501 344 502 345 501 345 501 1219 502 345 501 345 501 1219 502 345 501 345 501 1219 501 345 501 345 501 1219 501 1219 501 1219 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 502 345 501 345 501 345 501 346 500 345 501 345 501 345 501 345 501 345 501 1220 500 346 500 1220 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 347 499 346 500 347 499 347 499 370 476 1244 476 1221 499 1244 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 370 476 1245 475 1245 476 1245 475 371 475 370 476 370 476 371 475 371 475 370 476 370 476 371 475 371 476 370 476 370 476 371 475 371 475 371 475 371 475 371 475 1245 475 371 475 1245 475 371 475 371 475 371 475 1245 475 1245 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 476 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 371 475 1245 475 1245 475 1245 475 371 475 1245 475 1246 474
|
||||||
|
#
|
||||||
|
name: Heat_hi
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 535 314 532 314 533 313 533 312 534 313 533 312 508 24840 3569 1647 508 1213 536 342 505 342 504 341 505 1214 506 340 506 340 506 340 505 340 506 1214 506 341 504 1216 504 1217 503 343 503 1218 502 1219 501 1219 502 1219 502 1219 502 345 502 344 502 1219 502 345 501 345 502 345 502 345 501 345 501 345 501 345 501 345 501 345 502 345 501 1219 502 345 501 1219 501 345 502 345 501 345 501 1219 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1220 500 1219 501 1220 500 345 501 1220 500 345 501 1220 501 1220 500 34815 3564 1653 502 1218 502 344 502 345 501 344 502 1219 501 345 501 345 501 345 501 345 501 1219 502 345 501 1219 502 1220 501 345 502 1219 501 1219 502 1219 501 1219 502 1219 502 345 501 345 501 1220 501 345 502 345 501 345 501 345 501 345 501 345 501 345 502 345 501 345 502 345 501 345 501 1220 501 345 501 345 501 345 501 345 501 1220 500 345 501 346 501 1220 500 1220 501 345 501 345 501 346 500 1220 500 1220 500 1220 500 1220 500 346 500 346 500 346 500 345 501 346 500 345 501 1220 500 346 500 1220 500 1220 500 1220 500 346 500 346 500 346 500 34816 3565 1653 502 1219 501 344 502 345 501 345 501 1219 502 345 501 345 502 345 501 345 501 1219 501 345 501 1219 502 1219 501 345 501 1219 502 1219 501 1219 501 1219 501 1219 501 345 501 345 501 1219 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 345 501 1220 501 346 501 345 501 1220 501 346 500 346 500 1220 500 346 500 345 501 346 500 1220 500 1220 500 1220 501 1220 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 346 500 1220 500 346 500 1220 500 347 499 346 500 346 500 346 500 347 499 347 499 346 500 346 500 347 499 347 499 347 499 347 499 347 499 347 499 347 499 347 499 347 499 1222 498 1222 499 1222 498 347 499 348 498 348 498 347 499 371 475 348 498 348 498 348 498 371 475 1222 498 1246 474 1246 474 372 475 371 475 372 474 372 474 348 498 371 475 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 1246 474 372 474 1246 474 372 474 372 474 372 474 1246 474 1246 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 372 474 1246 474 372 474 1247 473 372 474 1246 474 1246 474 1246 474
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Filetype: IR library file
|
Filetype: IR library file
|
||||||
Version: 1
|
Version: 1
|
||||||
# Last Updated 1st Jul, 2023
|
# Last Updated 24th Jul, 2023
|
||||||
# Last Checked 13th Jul, 2023
|
# Last Checked 13th Jul, 2023
|
||||||
#
|
#
|
||||||
name: Power
|
name: Power
|
||||||
@ -2275,3 +2275,35 @@ type: parsed
|
|||||||
protocol: NEC
|
protocol: NEC
|
||||||
address: A0 00 00 00
|
address: A0 00 00 00
|
||||||
command: 5F 00 00 00
|
command: 5F 00 00 00
|
||||||
|
#
|
||||||
|
# Xiaomi TV
|
||||||
|
#
|
||||||
|
name: Power
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 1126 497 708 498 706 1433 708 1433 707 497 707 1458 707 497 707 1434 681 523 681 1459 681 1460 680 9808 1100 525 677 527 677 1464 676 1465 675 529 675 1466 674 530 675 1466 675 530 674 1466 674 1466 675 9814 1095 529 675 529 675 1466 675 1466 674 530 674 1466 675 530 674 1466 674 530 674 1466 675 1466 674 9814 1095 530 674 530 674 1466 674 1466 675 530 674 1467 674 530 674 1467 674 530 674 1467 674 1467 674 9814 1095 530 674 530 674 1467 674 1467 673 530 674 1467 673 531 674 1467 673 530 675 1467 673 1467 674 9814 1095 530 674 530 674 1467 674 1467 673 531 673 1467 674 531 673 1467 673 531 673 1467 673 1467 674
|
||||||
|
#
|
||||||
|
name: Vol_up
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 1126 496 707 1122 705 499 704 811 704 1124 704 502 701 502 702 1461 678 1150 677 527 677 527 676 12307 1096 529 675 1154 674 530 674 842 674 1155 673 530 674 530 674 1466 674 1154 674 531 673 530 674 12309 1094 530 674 1155 673 531 673 843 673 1155 673 531 673 530 674 1467 673 1155 673 530 674 531 673 12309 1094 530 674 1155 673 531 673 843 673 1155 673 531 673 531 673 1467 673 1155 673 531 673 531 673 12309 1094 531 673 1155 673 531 673 843 673 1155 673 531 673 531 673 1467 673 1155 673 531 673 531 673 12310 1093 531 673 1156 672 532 672 844 672 1156 672 532 672 532 672 1468 672 1157 671 532 672 532 672
|
||||||
|
#
|
||||||
|
name: Vol_dn
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 1096 528 676 1152 676 529 675 842 673 1155 674 530 674 530 674 1466 674 1467 673 531 674 843 673 11688 1094 530 674 1156 673 532 673 844 672 1156 673 531 673 531 674 1467 673 1468 673 531 673 843 675 11686 1095 530 674 1155 671 534 673 843 673 1156 672 532 673 531 674 1468 672 1468 673 530 674 843 673 11689 1092 532 672 1157 673 531 673 844 673 1155 673 531 674 530 673 1468 673 1467 674 531 673 844 671 11690 1093 532 673 1155 673 533 672 844 672 1156 672 531 673 532 672 1468 673 1468 673 531 673 844 671 11688 1095 531 672 1182 647 532 672 845 672 1156 672 532 671 534 672 1469 670 1469 671 534 672 845 671
|
||||||
|
#
|
||||||
|
name: Ch_next
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 1097 505 699 1154 673 531 673 842 675 1156 672 529 675 532 672 842 674 843 674 1156 672 1466 674 11688 1094 531 673 1157 671 531 673 844 671 1156 648 557 672 533 674 842 673 844 672 1156 673 1467 674 11687 1094 531 674 1157 670 534 671 843 674 1156 673 530 672 534 673 844 672 845 671 1158 671 1467 670 11690 1094 531 671 1158 671 531 673 844 674 1155 673 530 673 532 673 842 672 845 646 1184 699 1440 673 11687 1094 532 671 1157 672 531 673 844 672 1155 674 531 673 531 672 845 672 844 672 1157 670 1470 645 11715 1093 531 674 1155 673 531 673 870 647 1156 673 531 674 557 647 843 672 845 672 1156 673 1467 673
|
||||||
|
#
|
||||||
|
name: Ch_prev
|
||||||
|
type: raw
|
||||||
|
frequency: 38000
|
||||||
|
duty_cycle: 0.330000
|
||||||
|
data: 1119 528 675 1154 647 558 674 841 675 1153 675 531 673 532 673 843 673 1155 675 1153 674 531 673 12312 1120 505 672 1156 673 532 673 844 673 1155 673 532 671 534 672 842 675 1155 670 1158 673 530 674 12312 1093 532 671 1156 675 530 672 845 672 1156 673 533 671 533 670 846 672 1156 674 1154 674 529 675 12312 1093 557 646 1182 646 532 674 843 673 1181 646 534 672 532 674 842 673 1158 670 1156 674 530 673 12315 1091 530 674 1155 673 530 673 844 673 1157 644 559 673 532 672 844 670 1157 672 1158 672 532 672 12313 1093 533 671 1157 672 532 673 845 671 1157 670 558 647 532 646 871 672 1157 671 1181 646 534 671
|
||||||
|
@ -895,16 +895,10 @@ static void nfc_worker_mf_classic_key_attack(
|
|||||||
uint8_t block_num = mf_classic_get_sector_trailer_block_num_by_sector(i);
|
uint8_t block_num = mf_classic_get_sector_trailer_block_num_by_sector(i);
|
||||||
if(mf_classic_is_sector_read(data, i)) continue;
|
if(mf_classic_is_sector_read(data, i)) continue;
|
||||||
if(!mf_classic_is_key_found(data, i, MfClassicKeyA)) {
|
if(!mf_classic_is_key_found(data, i, MfClassicKeyA)) {
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Trying A key for sector %d, key: %012llX", i, key);
|
||||||
TAG,
|
|
||||||
"Trying A key for sector %d, key: %04lx%08lx",
|
|
||||||
i,
|
|
||||||
(uint32_t)(key >> 32),
|
|
||||||
(uint32_t)key);
|
|
||||||
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyA)) {
|
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyA)) {
|
||||||
mf_classic_set_key_found(data, i, MfClassicKeyA, key);
|
mf_classic_set_key_found(data, i, MfClassicKeyA, key);
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Key A found: %012llX", key);
|
||||||
TAG, "Key A found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
|
|
||||||
nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context);
|
||||||
|
|
||||||
uint64_t found_key;
|
uint64_t found_key;
|
||||||
@ -917,18 +911,13 @@ static void nfc_worker_mf_classic_key_attack(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
furi_hal_nfc_sleep();
|
||||||
}
|
}
|
||||||
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
|
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Trying B key for sector %d, key: %012llX", i, key);
|
||||||
TAG,
|
|
||||||
"Trying B key for sector %d, key: %04lx%08lx",
|
|
||||||
i,
|
|
||||||
(uint32_t)(key >> 32),
|
|
||||||
(uint32_t)key);
|
|
||||||
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyB)) {
|
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyB)) {
|
||||||
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Key B found: %012llX", key);
|
||||||
TAG, "Key B found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
|
|
||||||
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -976,8 +965,9 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
nfc_worker->callback(NfcWorkerEventNewSector, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventNewSector, nfc_worker->context);
|
||||||
uint8_t block_num = mf_classic_get_sector_trailer_block_num_by_sector(i);
|
uint8_t block_num = mf_classic_get_sector_trailer_block_num_by_sector(i);
|
||||||
if(mf_classic_is_sector_read(data, i)) continue;
|
if(mf_classic_is_sector_read(data, i)) continue;
|
||||||
bool is_key_a_found = mf_classic_is_key_found(data, i, MfClassicKeyA);
|
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
||||||
bool is_key_b_found = mf_classic_is_key_found(data, i, MfClassicKeyB);
|
mf_classic_is_key_found(data, i, MfClassicKeyB))
|
||||||
|
continue;
|
||||||
uint16_t key_index = 0;
|
uint16_t key_index = 0;
|
||||||
while(mf_classic_dict_get_next_key(dict, &key)) {
|
while(mf_classic_dict_get_next_key(dict, &key)) {
|
||||||
FURI_LOG_T(TAG, "Key %d", key_index);
|
FURI_LOG_T(TAG, "Key %d", key_index);
|
||||||
@ -995,19 +985,12 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
nfc_worker_mf_classic_key_attack(nfc_worker, prev_key, &tx_rx, i);
|
nfc_worker_mf_classic_key_attack(nfc_worker, prev_key, &tx_rx, i);
|
||||||
deactivated = true;
|
deactivated = true;
|
||||||
}
|
}
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Try to auth to sector %d with key %012llX", i, key);
|
||||||
TAG,
|
if(!mf_classic_is_key_found(data, i, MfClassicKeyA)) {
|
||||||
"Try to auth to sector %d with key %04lx%08lx",
|
|
||||||
i,
|
|
||||||
(uint32_t)(key >> 32),
|
|
||||||
(uint32_t)key);
|
|
||||||
if(!is_key_a_found) {
|
|
||||||
is_key_a_found = mf_classic_is_key_found(data, i, MfClassicKeyA);
|
|
||||||
if(mf_classic_authenticate_skip_activate(
|
if(mf_classic_authenticate_skip_activate(
|
||||||
&tx_rx, block_num, key, MfClassicKeyA, !deactivated, cuid)) {
|
&tx_rx, block_num, key, MfClassicKeyA, !deactivated, cuid)) {
|
||||||
mf_classic_set_key_found(data, i, MfClassicKeyA, key);
|
mf_classic_set_key_found(data, i, MfClassicKeyA, key);
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Key A found: %012llX", key);
|
||||||
TAG, "Key A found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
|
|
||||||
nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context);
|
||||||
|
|
||||||
uint64_t found_key;
|
uint64_t found_key;
|
||||||
@ -1037,17 +1020,35 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
|
|
||||||
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
||||||
memcmp(sec_trailer->key_a, current_key, 6) == 0) {
|
memcmp(sec_trailer->key_a, current_key, 6) == 0) {
|
||||||
|
if(!mf_classic_authenticate_skip_activate(
|
||||||
|
&tx_rx, block_num, key, MfClassicKeyA, !deactivated, cuid)) {
|
||||||
mf_classic_set_key_not_found(data, i, MfClassicKeyA);
|
mf_classic_set_key_not_found(data, i, MfClassicKeyA);
|
||||||
is_key_a_found = false;
|
|
||||||
FURI_LOG_D(TAG, "Key %dA not found in attack", i);
|
FURI_LOG_D(TAG, "Key %dA not found in attack", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!is_key_b_found) {
|
furi_hal_nfc_sleep();
|
||||||
is_key_b_found = mf_classic_is_key_found(data, i, MfClassicKeyB);
|
deactivated = true;
|
||||||
|
}
|
||||||
|
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
|
||||||
|
if(mf_classic_is_key_found(data, i, MfClassicKeyA)) {
|
||||||
|
uint64_t found_key;
|
||||||
|
if(nfc_worker_mf_get_b_key_from_sector_trailer(
|
||||||
|
&tx_rx, i, key, &found_key)) {
|
||||||
|
FURI_LOG_D(TAG, "Found B key via reading sector %d", i);
|
||||||
|
mf_classic_set_key_found(data, i, MfClassicKeyB, found_key);
|
||||||
|
|
||||||
|
if(nfc_worker->state == NfcWorkerStateMfClassicDictAttack) {
|
||||||
|
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_worker_mf_classic_key_attack(nfc_worker, found_key, &tx_rx, i + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(mf_classic_authenticate_skip_activate(
|
if(mf_classic_authenticate_skip_activate(
|
||||||
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) {
|
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) {
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(TAG, "Key B found: %012llX", key);
|
||||||
TAG, "Key B found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
|
|
||||||
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
||||||
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
||||||
nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1);
|
nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1);
|
||||||
@ -1063,12 +1064,18 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
|
|
||||||
if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
|
if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
|
||||||
memcmp(sec_trailer->key_b, current_key, 6) == 0) {
|
memcmp(sec_trailer->key_b, current_key, 6) == 0) {
|
||||||
|
if(!mf_classic_authenticate_skip_activate(
|
||||||
|
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) {
|
||||||
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
|
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
|
||||||
is_key_b_found = false;
|
|
||||||
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
|
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
|
||||||
}
|
}
|
||||||
|
furi_hal_nfc_sleep();
|
||||||
|
deactivated = true;
|
||||||
}
|
}
|
||||||
if(is_key_a_found && is_key_b_found) break;
|
}
|
||||||
|
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
||||||
|
mf_classic_is_key_found(data, i, MfClassicKeyB))
|
||||||
|
break;
|
||||||
if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break;
|
if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break;
|
||||||
} else {
|
} else {
|
||||||
if(!card_removed_notified) {
|
if(!card_removed_notified) {
|
||||||
|