From 82fcc76286575822573039659d7c10f40fa2cd8d Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 17 Oct 2023 21:25:16 +0200 Subject: [PATCH] Changed battery level curves based on experimental measures, thanks @spp2000 ! --- CHANGELOG.md | 3 +- firmware/application/src/ble_main.c | 55 ++++++++++------------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1bffce..520f252b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] - - Nested and StaticNested multithreaded decryption. + - Changed battery level curves based on experimental measures (@spp2000) + - Added multithreading on Nested and StaticNested (@xianglin1998) - Fixed factory reset hanging (@augustozanellato) - Changed fds_write_sync to take length in bytes instead of next multiple of 4 (@doegox) - Fixed field LED when LF reading and HF cloning (@doegox) diff --git a/firmware/application/src/ble_main.c b/firmware/application/src/ble_main.c index 79cfb7ef..44346b0a 100644 --- a/firmware/application/src/ble_main.c +++ b/firmware/application/src/ble_main.c @@ -226,44 +226,25 @@ __INLINE uint32_t map(uint32_t x, uint32_t in_min, uint32_t in_max, uint32_t out //Battery voltage to percentage calculation uint32_t BATVOL2PERCENT(uint16_t VOL) { - //100% 4.20V 1 - //90 % 4.06V 80%-100% white - //80 % 3.98V 1 - //70 % 3.92V 60%-80% white - //60 % 3.87V 1 - //50 % 3.82V 40%-60% white - //40 % 3.79V 1 - //30 % 3.77V 20%-40% white - //20 % 3.74V 1 - //10 % 3.68V 5%-20% red - //5 % 3.45V 1 Turn off - //0 % 3.00V - //#define P100VOL 4200 - //#define P80VOL 3980 - //#define P60VOL 3870 - //#define P40VOL 3790 - //#define P20VOL 3740 - //#define P5VOL 3450 - - //100% 4.20V 1 - //90 % 4.00V 80%-100% white - //80 % 3.89V 1 - //70 % 3.79V 60%-80% white - //60 % 3.70V 1 - //50 % 3.62V 40%-60% white - //40 % 3.57V 1 - //30 % 3.53V 20%-40% white - //20 % 3.51V 1 - //10 % 3.46V 5%-20% red - //5 % 3.43V 1 Turn off - //0 % 3.00V -#define P100VOL 4200 -#define P80VOL 3890 -#define P60VOL 3700 -#define P40VOL 3570 -#define P20VOL 3510 -#define P5VOL 3230 + // Based on https://github.com/RfidResearchGroup/ChameleonUltra/issues/167#issuecomment-1766908799 +#if defined(PROJECT_CHAMELEON_ULTRA) +// Ultra +#define P100VOL 4200 +#define P80VOL 4034 +#define P60VOL 3904 +#define P40VOL 3824 +#define P20VOL 3754 +#define P5VOL 3644 +#else +// Lite +#define P100VOL 4200 +#define P80VOL 3934 +#define P60VOL 3844 +#define P40VOL 3784 +#define P20VOL 3744 +#define P5VOL 3644 +#endif if (VOL > P80VOL) { //80-100