swap to bigbuf_calloc in pcf7939 Write on device side to lessen RAM footprint, Thanks Claude!

This commit is contained in:
iceman1001 committed 2026-08-30 11:29:39 +02:00
1 parent 27dd62e329
commit 2714628baf
2 files changed
+11 -2

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ 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]
- Changed `lf pcf7931` - now use bigbuf_calloc and much smaller array (@iceman1001)
- Changed `hf 15 sniff` - now uses bigbuf_calloc and lessen ram footprint on device (@iceman1001)
- Added individual json dump formats for ht2, ht1, htS, htU. No more .bin files either for hitag (@iceman1001)
- Change NG: iso14a_raw_cmd_t, convert hf 14a raw, dual-mode reader handler (@iceman1001)
+10 -2
View File
@@ -27,6 +27,12 @@
#include "string.h"
#define T0_PCF 8 //period for the pcf7931 in us
// Entries in the data frame array. Every AddBit/AddByte/AddPattern call appends 3 entries,
// and a write frame is 2 patterns + 77 bits + 1 pattern = 80 calls = 240 entries. 256 leaves
// the trailing zero the "tab[u] != 0" scans terminate on, and matches the uint8_t cursor in
// AddBitPCF7931, which cannot address past 255 anyway.
#define PCF7931_FRAME_ENTRIES 256
#define ALLOC 16
// IIR filter consts
@@ -437,7 +443,7 @@ static void RealWritePCF7931(
uint8_t address, uint8_t byte, uint8_t data,
bool ledcontrol) {
uint32_t tab[1024] = {0}; // data times frame
uint32_t tab[PCF7931_FRAME_ENTRIES] = {0}; // data times frame
uint32_t u = 0;
uint8_t parity = 0;
@@ -553,7 +559,9 @@ void SendCmdPCF7931(uint32_t *tab, bool ledcontrol) {
if (ledcontrol) LED_A_ON();
// rescale the values to match the time of the timer below.
for (u = 0; u < 500; ++u) {
// stop at the terminating zero like the loops below do, the caller's array
// is only as long as the frame needs
for (u = 0; tab[u] != 0; ++u) {
tab[u] = (tab[u] * 3) / 2;
}