Sensor

Pulse counting (ULP co-processor).

The counter class below is verbatim from the device firmware (firmware_core.py of Logger Pro v9).

Analog measurement note:

There is no separate analog-sensor class in the firmware. Raw ADC conversions are done by findylab.core.fw.adcMeasure() and the 4-20 mA scaling happens inline in the user-editable measure() hook in last.py:

ina1 = round(self.adcMeasure(b'') / 100, 2)      # mA
qty = (ina1 - sensor_min) * ((qty_max - qty_min) /
                             (sensor_max - sensor_min))

with the calibration values read from parameters 553-556 (AIN1) or 578-581 (AIN2) - see System IDs.

class findylab.sensor.counter[source]

ULP pulse counting on the two digital inputs (IO4/IO14).

Verbatim class from firmware_core.py. The ESP32 ULP co-processor samples the inputs every few milliseconds and counts debounced edges - including during deep sleep. Never instantiated; the methods take no self:

counter.getSamplings()

Note

Requires ulp_main.bin in the device filesystem - without it initCounter() raises OSError (ENOENT).

valFromMem()[source]

Reads one counter value from ULP memory.

Edge counters count both edges, so the raw value is halved.

Parameters:

val (int) – ULP memory address.

Returns:

Pulse count (raw edge count // 2).

Return type:

int

printAllSamplings()[source]

Dumps the ULP sample memory to the console (debug aid).

getSamplings()[source]

Collects the pulse deltas since the previous wakeup.

Verifies the ULP is alive (restarts it and clears the tracking parameters when frozen), reads both edge counters, computes the deltas with 15-bit overflow handling, accumulates them into parameters 437/439 and appends the deltas to ring-buffers 540/541.

initCounter()[source]

Loads and starts the ULP counting program.

Loads ulp_main.bin, configures the input pins, debounce, wakeup pulse count and the save period (from parameter 421), starts the co-processor and opens fresh ring-buffer slots.

Raises:

OSError – When ulp_main.bin is missing (ENOENT).