Skip to content

Commit

Permalink
Changed battery level curves based on experimental measures, thanks @…
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Oct 17, 2023
1 parent 652ee47 commit 82fcc76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 38 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
55 changes: 18 additions & 37 deletions firmware/application/src/ble_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82fcc76

Please sign in to comment.