Skip to content

Latest commit

 

History

History
75 lines (47 loc) · 1.82 KB

h4hw.md

File metadata and controls

75 lines (47 loc) · 1.82 KB

H4P Flyer

H4P_HeapWarn

Shortname hwrn

Send H4PE_SYSWARN event ("Heap,[1|0],N") when H4P's free heap drops below a safe level (determined as a percentage of its starting value).

Where 1=limit exceeded, 0=return below limit and N=current value

It is intended purely for debugging and is not normally required. It could typically be used to light/extinguish a warning LED to show a fault status.


Contents


Usage

H4P_HeapWarn h4hw(...

This plugin is a "singleton" - there may be only one single instance of it in the app. It may be instantiated as any name the user chooses, prefix all API calls below with than name.

Dependencies

N/A

Commands Added

  • h4/hwrn/pcent/N // payload N = some sensible percentage

Service Commands

stop has no effect

start has no effect

Callback functions

N/A


API

//  constructor:
//  onHeapWarning callback function
//  limit = "safe" percentage
H4P_HeapWarn(H4P_FN_VB onHeapWarning,uint32_t _limit=50);

void        pcent(uint32_t pc); // Set new "safe" percentage

Example code


(c) 2021 Phil Bowles [email protected]