Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
yoda2.h@18:e6ed582f7022, 2019-07-20 (annotated)
- Committer:
- hi1000
- Date:
- Sat Jul 20 03:57:26 2019 +0000
- Revision:
- 18:e6ed582f7022
- Parent:
- eventflags.h@17:faa4d4976d22
- Child:
- 19:0356e54240cc
Add Menu: Calibration Weight and Calibration
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hi1000 | 14:2e17a27f56b2 | 1 | #define BUTTON1_HOLD_EVENT 0x0001 |
hi1000 | 14:2e17a27f56b2 | 2 | #define BUTTON1_PRESSED_EVENT 0x0002 |
hi1000 | 14:2e17a27f56b2 | 3 | #define BUTTON2_HOLD_EVENT 0x0004 |
hi1000 | 14:2e17a27f56b2 | 4 | #define BUTTON2_PRESSED_EVENT 0x0008 |
hi1000 | 14:2e17a27f56b2 | 5 | #define BUTTON3_HOLD_EVENT 0x0010 |
hi1000 | 14:2e17a27f56b2 | 6 | #define BUTTON3_PRESSED_EVENT 0x0020 |
hi1000 | 14:2e17a27f56b2 | 7 | #define BUTTON4_HOLD_EVENT 0x0040 |
hi1000 | 14:2e17a27f56b2 | 8 | #define BUTTON4_PRESSED_EVENT 0x0080 |
hi1000 | 14:2e17a27f56b2 | 9 | #define MENU_HOLD_EVENT BUTTON4_HOLD_EVENT |
hi1000 | 14:2e17a27f56b2 | 10 | #define MENU_PRESSED_EVENT BUTTON4_PRESSED_EVENT |
hi1000 | 14:2e17a27f56b2 | 11 | #define ENTER_HOLD_EVENT BUTTON3_HOLD_EVENT |
hi1000 | 14:2e17a27f56b2 | 12 | #define ENTER_PRESSED_EVENT BUTTON3_PRESSED_EVENT |
hi1000 | 14:2e17a27f56b2 | 13 | #define LEFT_HOLD_EVENT BUTTON2_HOLD_EVENT |
hi1000 | 14:2e17a27f56b2 | 14 | #define LEFT_PRESSED_EVENT BUTTON2_PRESSED_EVENT |
hi1000 | 14:2e17a27f56b2 | 15 | #define RIGHT_HOLD_EVENT BUTTON1_HOLD_EVENT |
hi1000 | 14:2e17a27f56b2 | 16 | #define RIGHT_PRESSED_EVENT BUTTON1_PRESSED_EVENT |
hi1000 | 14:2e17a27f56b2 | 17 | #define LCD_DISPLAY_HOLD_EVENT 0x0001 |
hi1000 | 17:faa4d4976d22 | 18 | #define LCD_DISPLAY_RELEASE_EVENT 0x0002 |
hi1000 | 17:faa4d4976d22 | 19 | |
hi1000 | 17:faa4d4976d22 | 20 | #define COMMAND_INIT 0 // all the devices return to the point 0 and return the current possition or current weight |
hi1000 | 17:faa4d4976d22 | 21 | #define COMMAND_PLUS 1 // for the devices to plus weight return the weight |
hi1000 | 17:faa4d4976d22 | 22 | #define COMMAND_MINUS 2 // for the devices to minus weight return the weight |
hi1000 | 17:faa4d4976d22 | 23 | #define COMMAND_MOVE_ABSOLUTE 3 // for the devices to move to the absolute position return the current absolute position |
hi1000 | 17:faa4d4976d22 | 24 | #define COMMAND_MOVE_RELATIVE 4 // for the devices to move relative distance return the current absolute position |
hi1000 | 17:faa4d4976d22 | 25 | #define COMMAND_REPORT_WEIGHT 5 // for the devices to report the current weight |
hi1000 | 17:faa4d4976d22 | 26 | #define COMMAND_REPORT_POSITION 6 // for the devices to report the current absolute position |
hi1000 | 17:faa4d4976d22 | 27 | #define COMMAND_CLEAN 7 // for the devices to clean the cups return done or failed |
hi1000 | 17:faa4d4976d22 | 28 | #define COMMAND_TARE 8 // for the devices to tare the scale return done or failed |
hi1000 | 17:faa4d4976d22 | 29 | #define COMMAND_SHAKE_CUP 9 // for the device to shake the cups return done or failed |
hi1000 | 17:faa4d4976d22 | 30 | #define COMMAND_POUR_TEA 10 // for the device to pour the tea return done or failed |
hi1000 | 17:faa4d4976d22 | 31 | #define COMMAND_FINISH 11 // for everything finished return done or failed |
hi1000 | 18:e6ed582f7022 | 32 | #define COMMAND_RESET 12 // for the devices return to the point 0 and clean themselvies |
hi1000 | 18:e6ed582f7022 | 33 | |
hi1000 | 18:e6ed582f7022 | 34 | |
hi1000 | 18:e6ed582f7022 | 35 | #define WEIGHT_DIFFERENCE 200 // 10g ADC value minimum difference |
hi1000 | 18:e6ed582f7022 | 36 | #define CALIBRATION_WEIGHT 2000 // calibration weight |
hi1000 | 18:e6ed582f7022 | 37 | #define MAXIMUM_CALIBRATION_WEIGHT 5000 |
hi1000 | 18:e6ed582f7022 | 38 | #define MINIMUM_CALIBRATION_WEIGHT 100 |
hi1000 | 18:e6ed582f7022 | 39 | |
hi1000 | 18:e6ed582f7022 | 40 | enum Device_Type_d |
hi1000 | 18:e6ed582f7022 | 41 | { |
hi1000 | 18:e6ed582f7022 | 42 | CupTrack=0, |
hi1000 | 18:e6ed582f7022 | 43 | JamTrack=1, |
hi1000 | 18:e6ed582f7022 | 44 | TeaTrack=2, |
hi1000 | 18:e6ed582f7022 | 45 | Tea=3, |
hi1000 | 18:e6ed582f7022 | 46 | Jam=4, |
hi1000 | 18:e6ed582f7022 | 47 | Shaker=5 |
hi1000 | 18:e6ed582f7022 | 48 | }; |
hi1000 | 18:e6ed582f7022 | 49 | |
hi1000 | 18:e6ed582f7022 | 50 | struct ScaleCalibrationData { |
hi1000 | 18:e6ed582f7022 | 51 | unsigned int calibrationWeight; // the weight (g) used for calibration for example 1000g or 10g. The maximum value is 3000. |
hi1000 | 18:e6ed582f7022 | 52 | long offsetValue; // the value for scale offset |
hi1000 | 18:e6ed582f7022 | 53 | float scaleValue; // the ADC increment for 1g |
hi1000 | 18:e6ed582f7022 | 54 | uint8_t checksum; |
hi1000 | 18:e6ed582f7022 | 55 | }; |