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.
Dependencies: mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM
Alternator.h@3:43cb067ecd00, 2020-07-27 (annotated)
- Committer:
- JonFreeman
- Date:
- Mon Jul 27 08:44:59 2020 +0000
- Revision:
- 3:43cb067ecd00
- Parent:
- 2:8e7b51353f32
- Child:
- 4:28cc0cf01570
End of July after good day out at Ashton Court
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JonFreeman | 1:450090bdb6f4 | 1 | |
| JonFreeman | 3:43cb067ecd00 | 2 | //#define GPS_ // Not the crap one I tried! |
| JonFreeman | 1:450090bdb6f4 | 3 | |
| JonFreeman | 3:43cb067ecd00 | 4 | const double ALTERNATOR_DESIGN_VOLTAGE = 14.0; // Used to scale down max field pwm when available voltage higher than this |
| JonFreeman | 3:43cb067ecd00 | 5 | const double DRIVER_NEUTRAL = 0.18; // Proportion of driver's pot travel deemed to be zero power request |
| JonFreeman | 3:43cb067ecd00 | 6 | const uint32_t eeprom_page = 17; // Determines where in eeprom 'settings' reside |
| JonFreeman | 3:43cb067ecd00 | 7 | const int eeprom_page_size = 32; |
| JonFreeman | 3:43cb067ecd00 | 8 | const int PWM_PERIOD_US = 1800 ; // Was 2400, May want to reduce this, note would require change of resistor value on board |
| JonFreeman | 0:77803b3ee157 | 9 | |
| JonFreeman | 3:43cb067ecd00 | 10 | enum {TABL0, TABL1, TABL2, TABL3, TABL4, TABL5, TABL6, TABL7, TABL8, TABL9, TABL10, |
| JonFreeman | 3:43cb067ecd00 | 11 | TABL11, TABL12, TABL13, TABL14, TABL15, TABL16, TABL17, TABL18, TABL19, TABL20, |
| JonFreeman | 3:43cb067ecd00 | 12 | WARM_UP_DELAY, WARMUP_SERVO_POS, OP_MODE, SPEED_CTRL_P, SERVO_DIR, FUT27, FUT28, FUT29, FUT30, FUT31 } ; |
| JonFreeman | 0:77803b3ee157 | 13 | |
| JonFreeman | 3:43cb067ecd00 | 14 | struct sldandt { |
| JonFreeman | 3:43cb067ecd00 | 15 | const uint32_t min, max, de_fault; // min, max, default |
| JonFreeman | 3:43cb067ecd00 | 16 | const char * txt; // description |
| JonFreeman | 3:43cb067ecd00 | 17 | char val; |
| JonFreeman | 1:450090bdb6f4 | 18 | } ; |
| JonFreeman | 1:450090bdb6f4 | 19 | |
| JonFreeman | 3:43cb067ecd00 | 20 | |
| JonFreeman | 3:43cb067ecd00 | 21 | class ee_settings_2020 { |
| JonFreeman | 3:43cb067ecd00 | 22 | char new_settings[eeprom_page_size + 2]; |
| JonFreeman | 0:77803b3ee157 | 23 | public: |
| JonFreeman | 3:43cb067ecd00 | 24 | ee_settings_2020 () ; // Constructor |
| JonFreeman | 3:43cb067ecd00 | 25 | int load () ; |
| JonFreeman | 3:43cb067ecd00 | 26 | int save () ; |
| JonFreeman | 3:43cb067ecd00 | 27 | char rd (uint32_t i) ; |
| JonFreeman | 3:43cb067ecd00 | 28 | bool wr (char c, uint32_t i) ; // Write one setup char value to private buffer 'settings' |
| JonFreeman | 3:43cb067ecd00 | 29 | sldandt * inform (uint32_t which) ; |
| JonFreeman | 0:77803b3ee157 | 30 | } ; |
| JonFreeman | 0:77803b3ee157 | 31 | |
| JonFreeman | 2:8e7b51353f32 | 32 | const int MAX_PARAMS = 12; // Up from 10 May 2020 |
| JonFreeman | 3:43cb067ecd00 | 33 | struct parameters { // Used in Command Line Interpreter, stores user input values |
| JonFreeman | 3:43cb067ecd00 | 34 | int32_t position_in_list, numof_dbls; |
| JonFreeman | 1:450090bdb6f4 | 35 | double dbl[MAX_PARAMS]; |
| JonFreeman | 1:450090bdb6f4 | 36 | } ; |
| JonFreeman | 0:77803b3ee157 | 37 | |
| JonFreeman | 1:450090bdb6f4 | 38 | |
| JonFreeman | 3:43cb067ecd00 | 39 | /* |
| JonFreeman | 3:43cb067ecd00 | 40 | - Position the Cursor: |
| JonFreeman | 3:43cb067ecd00 | 41 | \033[<L>;<C>H |
| JonFreeman | 3:43cb067ecd00 | 42 | Or |
| JonFreeman | 3:43cb067ecd00 | 43 | \033[<L>;<C>f |
| JonFreeman | 3:43cb067ecd00 | 44 | puts the cursor at line L and column C. |
| JonFreeman | 3:43cb067ecd00 | 45 | - Move the cursor up N lines: |
| JonFreeman | 3:43cb067ecd00 | 46 | \033[<N>A |
| JonFreeman | 3:43cb067ecd00 | 47 | - Move the cursor down N lines: |
| JonFreeman | 3:43cb067ecd00 | 48 | \033[<N>B |
| JonFreeman | 3:43cb067ecd00 | 49 | - Move the cursor forward N columns: |
| JonFreeman | 3:43cb067ecd00 | 50 | \033[<N>C |
| JonFreeman | 3:43cb067ecd00 | 51 | - Move the cursor backward N columns: |
| JonFreeman | 3:43cb067ecd00 | 52 | \033[<N>D |
| JonFreeman | 3:43cb067ecd00 | 53 | |
| JonFreeman | 3:43cb067ecd00 | 54 | - Clear the screen, move to (0,0): |
| JonFreeman | 3:43cb067ecd00 | 55 | \033[2J |
| JonFreeman | 3:43cb067ecd00 | 56 | - Erase to end of line: |
| JonFreeman | 3:43cb067ecd00 | 57 | \033[K |
| JonFreeman | 3:43cb067ecd00 | 58 | |
| JonFreeman | 3:43cb067ecd00 | 59 | - Save cursor position: |
| JonFreeman | 3:43cb067ecd00 | 60 | \033[s might not work |
| JonFreeman | 3:43cb067ecd00 | 61 | - Restore cursor position: |
| JonFreeman | 3:43cb067ecd00 | 62 | \033[u might not work |
| JonFreeman | 3:43cb067ecd00 | 63 | */ |
| JonFreeman | 3:43cb067ecd00 | 64 |