Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
ColumnDHAutoCalibrationPageHandler.h@8:26e49e6955bd, 2017-07-31 (annotated)
- Committer:
- jmitc91516
- Date:
- Mon Jul 31 15:37:57 2017 +0000
- Revision:
- 8:26e49e6955bd
- Parent:
- 1:a5258871b33d
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 | 1:a5258871b33d | 1 | #ifndef COLUMNDHAUTOCALIBRATIONPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 2 | #define COLUMNDHAUTOCALIBRATIONPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 3 | |
jmitc91516 | 1:a5258871b33d | 4 | #include "mbed.h" |
jmitc91516 | 1:a5258871b33d | 5 | #include "DMBoard.h" |
jmitc91516 | 1:a5258871b33d | 6 | |
jmitc91516 | 1:a5258871b33d | 7 | #include "USBHostGC.h" |
jmitc91516 | 1:a5258871b33d | 8 | |
jmitc91516 | 1:a5258871b33d | 9 | #include "GuiLib.h" |
jmitc91516 | 1:a5258871b33d | 10 | |
jmitc91516 | 1:a5258871b33d | 11 | //#define USE_STABILISATION_TIMER // #define'd if we are using our own stabilisation timer - if not, we are getting the time from the GC |
jmitc91516 | 1:a5258871b33d | 12 | |
jmitc91516 | 1:a5258871b33d | 13 | #define USE_ENABLE_SET_BUTTON_FLAG // else - enable/disable based on current and previous calibration state |
jmitc91516 | 1:a5258871b33d | 14 | |
jmitc91516 | 1:a5258871b33d | 15 | // enum to make the different calibration state values (returned in response to the GC command "QDCS") more explicit |
jmitc91516 | 1:a5258871b33d | 16 | typedef enum enumCalibrationState { IDLE = 0, STAGE_1 = 1, STAGE_1A = 2, STAGE_2 = 3, STAGE_3 = 4, INVALID = -1 } CalibrationState; |
jmitc91516 | 1:a5258871b33d | 17 | |
jmitc91516 | 1:a5258871b33d | 18 | /* |
jmitc91516 | 1:a5258871b33d | 19 | This class handles user interaction with the easyGUI "ColumnDHAutoCalibrationPage", |
jmitc91516 | 1:a5258871b33d | 20 | as well as storing the values in QSPI memory. |
jmitc91516 | 1:a5258871b33d | 21 | |
jmitc91516 | 1:a5258871b33d | 22 | Note that this class is a singleton - we do not need or want there to be more than one instance of it |
jmitc91516 | 1:a5258871b33d | 23 | (we do not want multiple values for the calibration values, etc, and nor will we show |
jmitc91516 | 1:a5258871b33d | 24 | more than one easyGUI 'ColumnDHAutoCalibrationPage' to the user at the same time). |
jmitc91516 | 1:a5258871b33d | 25 | */ |
jmitc91516 | 1:a5258871b33d | 26 | |
jmitc91516 | 1:a5258871b33d | 27 | class ColumnDHAutoCalibrationPageHandler { |
jmitc91516 | 1:a5258871b33d | 28 | public: |
jmitc91516 | 1:a5258871b33d | 29 | /** |
jmitc91516 | 1:a5258871b33d | 30 | * Static method to create (if necessary) and retrieve the single ColumnDHAutoCalibrationPageHandler instance |
jmitc91516 | 1:a5258871b33d | 31 | */ |
jmitc91516 | 1:a5258871b33d | 32 | static ColumnDHAutoCalibrationPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 33 | |
jmitc91516 | 1:a5258871b33d | 34 | /** |
jmitc91516 | 1:a5258871b33d | 35 | * Version of the above that does not create the instance. Provided for callers that do not have |
jmitc91516 | 1:a5258871b33d | 36 | * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance |
jmitc91516 | 1:a5258871b33d | 37 | */ |
jmitc91516 | 1:a5258871b33d | 38 | static ColumnDHAutoCalibrationPageHandler * GetInstance(void); |
jmitc91516 | 1:a5258871b33d | 39 | |
jmitc91516 | 1:a5258871b33d | 40 | bool TouchAreaIsOnCalibrationPage(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 41 | |
jmitc91516 | 1:a5258871b33d | 42 | bool DealWithTouch(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 43 | |
jmitc91516 | 1:a5258871b33d | 44 | void DisplayingEasyGUIPage(void); |
jmitc91516 | 1:a5258871b33d | 45 | |
jmitc91516 | 1:a5258871b33d | 46 | void UpdateVolatileEasyGUIVariables(void); |
jmitc91516 | 1:a5258871b33d | 47 | |
jmitc91516 | 1:a5258871b33d | 48 | bool CalibratingNow(void); |
jmitc91516 | 1:a5258871b33d | 49 | |
jmitc91516 | 1:a5258871b33d | 50 | private: |
jmitc91516 | 1:a5258871b33d | 51 | static ColumnDHAutoCalibrationPageHandler * theColumnDHAutoCalibrationPageHandlerInstance; |
jmitc91516 | 1:a5258871b33d | 52 | |
jmitc91516 | 1:a5258871b33d | 53 | static const char* notAvailable; |
jmitc91516 | 1:a5258871b33d | 54 | |
jmitc91516 | 1:a5258871b33d | 55 | USBDeviceConnected* usbDevice; |
jmitc91516 | 1:a5258871b33d | 56 | USBHostGC* usbHostGC; |
jmitc91516 | 1:a5258871b33d | 57 | |
jmitc91516 | 1:a5258871b33d | 58 | // singleton class -> constructor is private |
jmitc91516 | 1:a5258871b33d | 59 | ColumnDHAutoCalibrationPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 60 | ~ColumnDHAutoCalibrationPageHandler(); |
jmitc91516 | 1:a5258871b33d | 61 | |
jmitc91516 | 1:a5258871b33d | 62 | void UpdateEasyGUIPage(void); |
jmitc91516 | 1:a5258871b33d | 63 | |
jmitc91516 | 1:a5258871b33d | 64 | float calibTemperature[3]; |
jmitc91516 | 1:a5258871b33d | 65 | float calibResistance[3]; |
jmitc91516 | 1:a5258871b33d | 66 | int stabilisationTime; |
jmitc91516 | 1:a5258871b33d | 67 | |
jmitc91516 | 1:a5258871b33d | 68 | float actualColumnResistance; |
jmitc91516 | 1:a5258871b33d | 69 | |
jmitc91516 | 1:a5258871b33d | 70 | void SetEasyGUICalibrationPointTemperatureFromInternalValue(bool updateBoth); |
jmitc91516 | 1:a5258871b33d | 71 | void SetEasyGUICalibrationPointResistanceFromInternalValue(void); |
jmitc91516 | 1:a5258871b33d | 72 | void SetEasyGUIStabilisationTimeFromInternalValue(void); |
jmitc91516 | 1:a5258871b33d | 73 | |
jmitc91516 | 1:a5258871b33d | 74 | void ConstructStartCalibrationCommand(char* commandBuffer); |
jmitc91516 | 1:a5258871b33d | 75 | void ConstructStopCalibrationCommand(char* commandBuffer); |
jmitc91516 | 1:a5258871b33d | 76 | |
jmitc91516 | 1:a5258871b33d | 77 | void SendCommandToGCAndGetResponse(char* command, char* response); |
jmitc91516 | 1:a5258871b33d | 78 | bool SendCommandToGCWithDACKResponse(char *cmd); |
jmitc91516 | 1:a5258871b33d | 79 | |
jmitc91516 | 1:a5258871b33d | 80 | CalibrationState GetCalibrationState(void); |
jmitc91516 | 1:a5258871b33d | 81 | |
jmitc91516 | 1:a5258871b33d | 82 | void SetEasyGUICalibrationState(void); |
jmitc91516 | 1:a5258871b33d | 83 | void SetEasyGUIHeatState(void); |
jmitc91516 | 1:a5258871b33d | 84 | void SetEasyGUIOvenTemperature(void); |
jmitc91516 | 1:a5258871b33d | 85 | void ShowSetCalibrationButtonEnabledState(void); |
jmitc91516 | 1:a5258871b33d | 86 | |
jmitc91516 | 1:a5258871b33d | 87 | void SetEasyGUICalibrationTimeRemaining(void); |
jmitc91516 | 1:a5258871b33d | 88 | |
jmitc91516 | 1:a5258871b33d | 89 | int GetStabilisationTimeFromGC(void); |
jmitc91516 | 1:a5258871b33d | 90 | bool SetStabilisationTimeInGC(int value); |
jmitc91516 | 1:a5258871b33d | 91 | |
jmitc91516 | 1:a5258871b33d | 92 | float GetColumnTemperaturePointFromGC(int pointIndex); |
jmitc91516 | 1:a5258871b33d | 93 | float GetColumnResistancePointFromGC(int pointIndex); |
jmitc91516 | 1:a5258871b33d | 94 | |
jmitc91516 | 1:a5258871b33d | 95 | void SetColumnTemperaturePointInGC(int pointIndex, float temperatureToSet); |
jmitc91516 | 1:a5258871b33d | 96 | void SetColumnResistancePointInGC(int pointIndex, float resistanceToSet); |
jmitc91516 | 1:a5258871b33d | 97 | |
jmitc91516 | 1:a5258871b33d | 98 | bool TellGCToMeasureColumnResistance(void); |
jmitc91516 | 1:a5258871b33d | 99 | |
jmitc91516 | 1:a5258871b33d | 100 | float GetActualColumnResistanceFromGC(void); |
jmitc91516 | 1:a5258871b33d | 101 | |
jmitc91516 | 1:a5258871b33d | 102 | float GetCurrentOvenTemperature(void); |
jmitc91516 | 1:a5258871b33d | 103 | |
jmitc91516 | 1:a5258871b33d | 104 | void DisplayGettingColumnResistancePage(void); |
jmitc91516 | 1:a5258871b33d | 105 | void RedisplayColumnCalibrationPage(); |
jmitc91516 | 1:a5258871b33d | 106 | |
jmitc91516 | 1:a5258871b33d | 107 | CalibrationState currentCalibrationState; |
jmitc91516 | 1:a5258871b33d | 108 | CalibrationState previousCalibrationState; |
jmitc91516 | 1:a5258871b33d | 109 | |
jmitc91516 | 1:a5258871b33d | 110 | bool needToGetColumnResistance; |
jmitc91516 | 1:a5258871b33d | 111 | |
jmitc91516 | 1:a5258871b33d | 112 | #ifdef USE_STABILISATION_TIMER |
jmitc91516 | 1:a5258871b33d | 113 | Timer stabilisationTimer; |
jmitc91516 | 1:a5258871b33d | 114 | #else |
jmitc91516 | 1:a5258871b33d | 115 | float GetTimeFromGC(void); |
jmitc91516 | 1:a5258871b33d | 116 | float gcTimeStabilisationStarted; |
jmitc91516 | 1:a5258871b33d | 117 | #endif |
jmitc91516 | 1:a5258871b33d | 118 | |
jmitc91516 | 1:a5258871b33d | 119 | #ifdef USE_ENABLE_SET_BUTTON_FLAG |
jmitc91516 | 1:a5258871b33d | 120 | bool enableSetButton; |
jmitc91516 | 1:a5258871b33d | 121 | #endif |
jmitc91516 | 1:a5258871b33d | 122 | }; |
jmitc91516 | 1:a5258871b33d | 123 | |
jmitc91516 | 1:a5258871b33d | 124 | #endif // COLUMNDHAUTOCALIBRATIONPAGEHANDLER_H |