= Weighing Functions = [[TOC(inline, depth=1, noheading, Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight/*)]] == Minimal Weight Indicator Sample Program == This is an example of a very simple weight indicator program to display the gross weight. "Zero" and "Quit" buttons are provided. This is a minimal program for demonstration purposes. An application to be used in a production environment should have display scale status such as "Motion", and display error messages such as if the zero operation fails due to motion. [[Image(simple_ind.png)]] simple_ind.h {{{ #pragma once EVENT(MainScreenShow); EVENT(MainScreenProcess); EVENT(Zero); EVENT(Quit); }}} simple_ind.cpp {{{ #include "cardinal825.h" #include "simple_ind.h" int main(int ac,char **av) { InitLCD(); ReadTouchCal(); OpenBeeper(); OpenTouch(); MnBdStartup(); FORM_INIT(Main, EventMainScreenShow, EventMainScreenProcess, NULL, NULL, nFormFlgNone); FORM_ADD_BUTTON(Main, Zero, 0, 120, "Zero", 'Z', EventZero, FORM_BUTTON_OUTLINE); FORM_ADD_BUTTON(Main, Quit, 0, 200, "Quit", 'Q', EventQuit, FORM_BUTTON_OUTLINE); FORM_SHOW(Main); FORM_RUN(Main); FORM_HIDE(Main); MnBdShutdown(); return 0; } EVENT(MainScreenShow) { ClearLCD(); DisplayText(0, 0, "Simple Weight Indicator"); return 0; } EVENT(MainScreenProcess) { int n = MnBdProcess(); if(n == mnbdProcWtRcv) { if(IsGrossWtChanged(1)) { DisplayText(0, 40, GetChangedGrossWt(1), 0, BIG_FONT); } } return 0; } EVENT(Zero) { ZeroScale(1); return 0; } EVENT(Quit) { // Return non-zero to exit the form return 1; } }}}