Changes between Version 12 and Version 13 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight
- Timestamp:
- 02/25/20 16:47:03 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight
v12 v13 8 8 [[Image(simple_ind.png)]] 9 9 10 simple_ind.h 10 11 simple_ind.h: 11 12 {{{ 12 #pragma once 13 #ifndef SIMPLE_IND_H_ 14 #define SIMPLE_IND_H_ 13 15 14 16 EVENT(MainScreenShow); 15 EVENT(MainScreenProcess);16 17 EVENT(Zero); 17 18 EVENT(Quit); 19 20 BACKGROUND_EVENT(Comm); 21 22 MNBD_EVENT(MultiRcv); 23 EVENT(Exit); 24 25 26 27 #endif /* SIMPLE_IND_H_ */ 28 18 29 }}} 19 30 20 simple_ind.cpp 31 simple_ind.cpp: 32 21 33 {{{ 22 34 #include "cardinal825.h" … … 24 36 #include "simple_ind.h" 25 37 26 int main( int ac,char **av)38 int main() 27 39 { 28 40 InitLCD(); 41 42 SetCurColor(COLOR_ATTENTION); 43 DisplayText(0, 0, "Simple Indicator Example"); 29 44 30 45 ReadTouchCal(); … … 34 49 MnBdStartup(); 35 50 36 FORM_INIT(Main, EventMainScreenShow, EventMainScreenProcess, NULL, NULL, nFormFlgNone); 51 MnBdSetEvent(MNBD_REQ_REP_MULTI, MnBdEventMultiRcv); 52 53 SetBackgroundEvent(BackgroundEventComm); 54 55 if(StartRepeatMulti(100) != OK) 56 { 57 DisplayText(0, FONT_HEIGHT, "Error starting repeat multi"); 58 return 0; 59 } 60 61 FORM_INIT(Main, EventMainScreenShow, NULL, NULL, NULL, nFormFlgNone); 62 63 FORM_ADD_BUTTON(Main, Exit, 0, FONT_HEIGHT * 12, " Exit ", 'X', EventExit, FORM_BUTTON_INVERT); 37 64 FORM_ADD_BUTTON(Main, Zero, 0, 120, "Zero", 'Z', EventZero, FORM_BUTTON_OUTLINE); 38 65 FORM_ADD_BUTTON(Main, Quit, 0, 200, "Quit", 'Q', EventQuit, FORM_BUTTON_OUTLINE); … … 41 68 FORM_RUN(Main); 42 69 FORM_HIDE(Main); 70 71 MnBdClearCommEvent(); 72 73 StopRepeatMulti(); 74 SetBackgroundEvent(NULL); 43 75 44 76 MnBdShutdown(); … … 50 82 { 51 83 ClearLCD(); 52 DisplayText(0, 0, "Simple Weight Indicator"); 84 SetCurColor(COLOR_ATTENTION); 85 DisplayText(0, 0, "Simple Indicator Example"); 86 87 ResetPrevGrossWt(); 53 88 return 0; 54 89 } 55 90 56 EVENT( MainScreenProcess)91 EVENT(Exit) 57 92 { 58 int n = MnBdProcess(); 59 if(n == mnbdProcWtRcv) 93 return 1; // return non-zero to exit form 94 } 95 96 MNBD_EVENT(MultiRcv) 97 { 98 int n; 99 for(n = 1; n <= GetNumScales(); n++) 60 100 { 61 if(IsGrossWtChanged( 1))101 if(IsGrossWtChanged(n)) 62 102 { 63 DisplayText(0, 40, GetChangedGrossWt(1), 0, BIG_FONT);103 DisplayText(0, (FONT_HEIGHT * n) + FONT_HEIGHT, GetChangedGrossWt(n)); 64 104 } 105 } 106 return 0; 107 } 108 109 BACKGROUND_EVENT(Comm) 110 { 111 // Use MnBdRead directly to prevent overhead of MnBdProcess 112 // MnBdRead will call event MultiRcv that we registered previously when scale and DIO status is received 113 114 int n; 115 // in case we have more I/O cards than scales change this 116 for(n = 0; n <= GetNumScales(); n++) 117 { 118 // 0 = MNBD_DEV, 1 .. Scales and I/O cards 119 MnBdRead(n); 65 120 } 66 121 … … 79 134 return 1; 80 135 } 136 81 137 }}} 82 138 139 140 141