Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
MethodRampData.h@8:26e49e6955bd, 2017-07-31 (annotated)
- Committer:
- jmitc91516
- Date:
- Mon Jul 31 15:37:57 2017 +0000
- Revision:
- 8:26e49e6955bd
- Parent:
- 6:dba3fbdfd5da
Method ramp scrolling improved, and more bitmaps moved to QSPI memory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 6:dba3fbdfd5da | 1 | #ifndef METHODRAMPDATA_H |
jmitc91516 | 6:dba3fbdfd5da | 2 | #define METHODRAMPDATA_H |
jmitc91516 | 6:dba3fbdfd5da | 3 | |
jmitc91516 | 6:dba3fbdfd5da | 4 | #include "GuiLib.h" |
jmitc91516 | 6:dba3fbdfd5da | 5 | #include "GuiDisplay.h" |
jmitc91516 | 6:dba3fbdfd5da | 6 | |
jmitc91516 | 6:dba3fbdfd5da | 7 | #include "USBHostGC.h" |
jmitc91516 | 6:dba3fbdfd5da | 8 | |
jmitc91516 | 6:dba3fbdfd5da | 9 | /* |
jmitc91516 | 6:dba3fbdfd5da | 10 | These classes deal with the method ramps - column, injector or gas. |
jmitc91516 | 6:dba3fbdfd5da | 11 | They obtain all the ramp data at the same time, and can then return information about the ramps to the caller. |
jmitc91516 | 6:dba3fbdfd5da | 12 | |
jmitc91516 | 6:dba3fbdfd5da | 13 | Provided to simplify the ramp handling, and particularly to avoid adding yet more code to "GetGCStatusLoop". |
jmitc91516 | 6:dba3fbdfd5da | 14 | |
jmitc91516 | 6:dba3fbdfd5da | 15 | The base class does most of the work, since the ramp handling is basically the same for the column, injector and gas - but is abstract. |
jmitc91516 | 6:dba3fbdfd5da | 16 | Derived classes must define the functions to get the ramp data from the GC, since the commands to do so are different for each type. |
jmitc91516 | 6:dba3fbdfd5da | 17 | */ |
jmitc91516 | 6:dba3fbdfd5da | 18 | class MethodRampData |
jmitc91516 | 6:dba3fbdfd5da | 19 | { |
jmitc91516 | 6:dba3fbdfd5da | 20 | public: |
jmitc91516 | 6:dba3fbdfd5da | 21 | |
jmitc91516 | 6:dba3fbdfd5da | 22 | // Public constructor. |
jmitc91516 | 6:dba3fbdfd5da | 23 | // |
jmitc91516 | 6:dba3fbdfd5da | 24 | // There seems no particular reason to make this class a singleton. |
jmitc91516 | 6:dba3fbdfd5da | 25 | // There is only one method loaded into the GC at any time, |
jmitc91516 | 6:dba3fbdfd5da | 26 | // but so what if we have more than one copy of the ramp data? |
jmitc91516 | 6:dba3fbdfd5da | 27 | MethodRampData(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 6:dba3fbdfd5da | 28 | |
jmitc91516 | 6:dba3fbdfd5da | 29 | void GetRampDataFromGC(void); |
jmitc91516 | 6:dba3fbdfd5da | 30 | |
jmitc91516 | 6:dba3fbdfd5da | 31 | bool GetRampRate(unsigned int rampIndex, float *rampRate); |
jmitc91516 | 6:dba3fbdfd5da | 32 | bool GetRampUpperLimit(unsigned int rampIndex, float *rampUpperLimit); |
jmitc91516 | 6:dba3fbdfd5da | 33 | bool GetRampUpperTime(unsigned int rampIndex, float *rampUpperTime); |
jmitc91516 | 6:dba3fbdfd5da | 34 | |
jmitc91516 | 6:dba3fbdfd5da | 35 | unsigned int GetRampCount(void) { return rampCount; } |
jmitc91516 | 6:dba3fbdfd5da | 36 | bool GotRampData(void) { return gotRampData; } |
jmitc91516 | 6:dba3fbdfd5da | 37 | |
jmitc91516 | 6:dba3fbdfd5da | 38 | void RampsHaveBeenChangedInGC(void) { gotRampData = false; } |
jmitc91516 | 6:dba3fbdfd5da | 39 | |
jmitc91516 | 6:dba3fbdfd5da | 40 | void UpdateEasyGUIMethodPageVariables(unsigned int firstRampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 41 | |
jmitc91516 | 6:dba3fbdfd5da | 42 | bool NeedToUpdateEasyGUIMethodPageRampVariables(void) { return needToUpdateEasyGUIMethodPageRampVariables; } |
jmitc91516 | 6:dba3fbdfd5da | 43 | |
jmitc91516 | 6:dba3fbdfd5da | 44 | unsigned int GetScrollRange(void); |
jmitc91516 | 6:dba3fbdfd5da | 45 | |
jmitc91516 | 6:dba3fbdfd5da | 46 | protected: |
jmitc91516 | 6:dba3fbdfd5da | 47 | // Different GC commands for each ramp type |
jmitc91516 | 6:dba3fbdfd5da | 48 | virtual float GetRampRateFromGC(unsigned int rampIndex) = 0; |
jmitc91516 | 6:dba3fbdfd5da | 49 | virtual float GetRampUpperLimitFromGC(unsigned int rampIndex) = 0; |
jmitc91516 | 6:dba3fbdfd5da | 50 | virtual float GetRampUpperTimeFromGC(unsigned int rampIndex) = 0; |
jmitc91516 | 6:dba3fbdfd5da | 51 | |
jmitc91516 | 6:dba3fbdfd5da | 52 | // Different easyGUI variables for each ramp type |
jmitc91516 | 6:dba3fbdfd5da | 53 | enum { EASYGUI_RAMP_LINES = 5 }; |
jmitc91516 | 6:dba3fbdfd5da | 54 | GuiConst_TEXT* easyGUIRampNumber[EASYGUI_RAMP_LINES]; |
jmitc91516 | 6:dba3fbdfd5da | 55 | GuiConst_TEXT* easyGUIRampRateVariable[EASYGUI_RAMP_LINES]; |
jmitc91516 | 6:dba3fbdfd5da | 56 | GuiConst_TEXT* easyGUIRampUpperLimitVariable[EASYGUI_RAMP_LINES]; |
jmitc91516 | 6:dba3fbdfd5da | 57 | GuiConst_TEXT* easyGUIRampUpperTimeVariable[EASYGUI_RAMP_LINES]; |
jmitc91516 | 6:dba3fbdfd5da | 58 | |
jmitc91516 | 8:26e49e6955bd | 59 | // Different units for the method ramp values in each ramp type - so apply a different format string |
jmitc91516 | 8:26e49e6955bd | 60 | // when sprintf'ing the values to the corresponding easyGUI variables |
jmitc91516 | 6:dba3fbdfd5da | 61 | char easyGUIRampRateSprintfFormat[10]; |
jmitc91516 | 6:dba3fbdfd5da | 62 | char easyGUIRampUpperLimitSprintfFormat[10]; |
jmitc91516 | 6:dba3fbdfd5da | 63 | char easyGUIRampUpperTimeSprintfFormat[10]; |
jmitc91516 | 8:26e49e6955bd | 64 | |
jmitc91516 | 8:26e49e6955bd | 65 | // Different variables for the ramp row colours (to show scrolling) |
jmitc91516 | 8:26e49e6955bd | 66 | GuiConst_INTCOLOR* easyGUIMethodRampOddRowsColour; |
jmitc91516 | 8:26e49e6955bd | 67 | GuiConst_INTCOLOR* easyGUIMethodRampEvenRowsColour; |
jmitc91516 | 6:dba3fbdfd5da | 68 | |
jmitc91516 | 6:dba3fbdfd5da | 69 | int GetIntRampValueFromGC(char *firstThreeCharsOfCommand, unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 70 | |
jmitc91516 | 6:dba3fbdfd5da | 71 | private: |
jmitc91516 | 6:dba3fbdfd5da | 72 | |
jmitc91516 | 6:dba3fbdfd5da | 73 | typedef struct structRampData |
jmitc91516 | 6:dba3fbdfd5da | 74 | { |
jmitc91516 | 6:dba3fbdfd5da | 75 | float rampRate; |
jmitc91516 | 6:dba3fbdfd5da | 76 | float rampUpperLimit; |
jmitc91516 | 6:dba3fbdfd5da | 77 | float rampUpperTime; |
jmitc91516 | 6:dba3fbdfd5da | 78 | |
jmitc91516 | 6:dba3fbdfd5da | 79 | } RampData; |
jmitc91516 | 6:dba3fbdfd5da | 80 | |
jmitc91516 | 6:dba3fbdfd5da | 81 | enum { MAX_RAMP_COUNT = 10 }; |
jmitc91516 | 6:dba3fbdfd5da | 82 | RampData rampData[MAX_RAMP_COUNT]; |
jmitc91516 | 6:dba3fbdfd5da | 83 | |
jmitc91516 | 6:dba3fbdfd5da | 84 | USBDeviceConnected* usbDevice; |
jmitc91516 | 6:dba3fbdfd5da | 85 | USBHostGC* usbHostGC; |
jmitc91516 | 6:dba3fbdfd5da | 86 | |
jmitc91516 | 6:dba3fbdfd5da | 87 | unsigned int rampCount; |
jmitc91516 | 6:dba3fbdfd5da | 88 | bool gotRampData; |
jmitc91516 | 6:dba3fbdfd5da | 89 | |
jmitc91516 | 6:dba3fbdfd5da | 90 | bool needToUpdateEasyGUIMethodPageRampVariables; |
jmitc91516 | 8:26e49e6955bd | 91 | |
jmitc91516 | 8:26e49e6955bd | 92 | static const GuiConst_INTCOLOR oddRampEasyGUIColour; |
jmitc91516 | 8:26e49e6955bd | 93 | static const GuiConst_INTCOLOR evenRampEasyGUIColour; |
jmitc91516 | 6:dba3fbdfd5da | 94 | }; |
jmitc91516 | 6:dba3fbdfd5da | 95 | |
jmitc91516 | 6:dba3fbdfd5da | 96 | |
jmitc91516 | 6:dba3fbdfd5da | 97 | /* |
jmitc91516 | 6:dba3fbdfd5da | 98 | Derived class for the column method - with its own commands to get the data from the GC, |
jmitc91516 | 6:dba3fbdfd5da | 99 | and its own easyGUI variables to display the data |
jmitc91516 | 6:dba3fbdfd5da | 100 | */ |
jmitc91516 | 6:dba3fbdfd5da | 101 | class ColumnMethodRampData : public MethodRampData |
jmitc91516 | 6:dba3fbdfd5da | 102 | { |
jmitc91516 | 6:dba3fbdfd5da | 103 | public: |
jmitc91516 | 6:dba3fbdfd5da | 104 | ColumnMethodRampData(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 6:dba3fbdfd5da | 105 | |
jmitc91516 | 6:dba3fbdfd5da | 106 | private: |
jmitc91516 | 6:dba3fbdfd5da | 107 | virtual float GetRampRateFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 108 | virtual float GetRampUpperLimitFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 109 | virtual float GetRampUpperTimeFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 110 | }; |
jmitc91516 | 6:dba3fbdfd5da | 111 | |
jmitc91516 | 6:dba3fbdfd5da | 112 | |
jmitc91516 | 6:dba3fbdfd5da | 113 | /* |
jmitc91516 | 6:dba3fbdfd5da | 114 | Derived class for the injector method - with its own commands to get the data from the GC, |
jmitc91516 | 6:dba3fbdfd5da | 115 | and its own easyGUI variables to display the data |
jmitc91516 | 6:dba3fbdfd5da | 116 | */ |
jmitc91516 | 6:dba3fbdfd5da | 117 | class InjectorMethodRampData : public MethodRampData |
jmitc91516 | 6:dba3fbdfd5da | 118 | { |
jmitc91516 | 6:dba3fbdfd5da | 119 | public: |
jmitc91516 | 6:dba3fbdfd5da | 120 | InjectorMethodRampData(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 6:dba3fbdfd5da | 121 | |
jmitc91516 | 6:dba3fbdfd5da | 122 | private: |
jmitc91516 | 6:dba3fbdfd5da | 123 | virtual float GetRampRateFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 124 | virtual float GetRampUpperLimitFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 125 | virtual float GetRampUpperTimeFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 126 | }; |
jmitc91516 | 6:dba3fbdfd5da | 127 | |
jmitc91516 | 6:dba3fbdfd5da | 128 | |
jmitc91516 | 6:dba3fbdfd5da | 129 | /* |
jmitc91516 | 6:dba3fbdfd5da | 130 | Derived class for the gas method - with its own commands to get the data from the GC, |
jmitc91516 | 6:dba3fbdfd5da | 131 | and its own easyGUI variables to display the data |
jmitc91516 | 6:dba3fbdfd5da | 132 | */ |
jmitc91516 | 6:dba3fbdfd5da | 133 | class GasMethodRampData : public MethodRampData |
jmitc91516 | 6:dba3fbdfd5da | 134 | { |
jmitc91516 | 6:dba3fbdfd5da | 135 | public: |
jmitc91516 | 6:dba3fbdfd5da | 136 | GasMethodRampData(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 6:dba3fbdfd5da | 137 | |
jmitc91516 | 6:dba3fbdfd5da | 138 | private: |
jmitc91516 | 6:dba3fbdfd5da | 139 | virtual float GetRampRateFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 140 | virtual float GetRampUpperLimitFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 141 | virtual float GetRampUpperTimeFromGC(unsigned int rampIndex); |
jmitc91516 | 6:dba3fbdfd5da | 142 | }; |
jmitc91516 | 6:dba3fbdfd5da | 143 | |
jmitc91516 | 6:dba3fbdfd5da | 144 | #endif // METHODRAMPDATA_H |
jmitc91516 | 6:dba3fbdfd5da | 145 |