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 mbed-STM32F103C8T6
heatcontrol.h@8:2b0d18ebbba9, 2020-06-10 (annotated)
- Committer:
- lorded
- Date:
- Wed Jun 10 22:31:30 2020 +0000
- Revision:
- 8:2b0d18ebbba9
- Child:
- 10:a82e51837e2b
initial canbus controller commit.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lorded | 8:2b0d18ebbba9 | 1 | #ifndef __HEATCONTROL_H |
lorded | 8:2b0d18ebbba9 | 2 | #define __HEATCONTROL_H |
lorded | 8:2b0d18ebbba9 | 3 | #include "stdint.h" |
lorded | 8:2b0d18ebbba9 | 4 | #include "wiced_types.h" |
lorded | 8:2b0d18ebbba9 | 5 | |
lorded | 8:2b0d18ebbba9 | 6 | |
lorded | 8:2b0d18ebbba9 | 7 | #define HEATFAULTCYCLELENGTH 102 |
lorded | 8:2b0d18ebbba9 | 8 | #define HEATFAULTCYCLEHOLDOFF -240 |
lorded | 8:2b0d18ebbba9 | 9 | |
lorded | 8:2b0d18ebbba9 | 10 | |
lorded | 8:2b0d18ebbba9 | 11 | typedef enum {HEATCALLOFF=0, HEATCALLON=1, HEATCALLINIT=2, HEATCALLLONGRUN=3} heatcall; |
lorded | 8:2b0d18ebbba9 | 12 | |
lorded | 8:2b0d18ebbba9 | 13 | |
lorded | 8:2b0d18ebbba9 | 14 | #define IDLE 0 |
lorded | 8:2b0d18ebbba9 | 15 | |
lorded | 8:2b0d18ebbba9 | 16 | #define HEATERSTATECOUNT 2 |
lorded | 8:2b0d18ebbba9 | 17 | #define RESETHEATTIME 60*60*8; // 8hours |
lorded | 8:2b0d18ebbba9 | 18 | #define LIN_RX_BUFFER_SIZE 64 |
lorded | 8:2b0d18ebbba9 | 19 | #define LIN_UART WICED_UART_2 |
lorded | 8:2b0d18ebbba9 | 20 | |
lorded | 8:2b0d18ebbba9 | 21 | |
lorded | 8:2b0d18ebbba9 | 22 | extern struct sHeatVars heaterState[HEATERSTATECOUNT]; |
lorded | 8:2b0d18ebbba9 | 23 | |
lorded | 8:2b0d18ebbba9 | 24 | struct sHeatVars { |
lorded | 8:2b0d18ebbba9 | 25 | int primeFuelPumpCount; |
lorded | 8:2b0d18ebbba9 | 26 | wiced_bool_t heatCallDetected; |
lorded | 8:2b0d18ebbba9 | 27 | int heaterDetected; |
lorded | 8:2b0d18ebbba9 | 28 | wiced_bool_t OBAltitude; |
lorded | 8:2b0d18ebbba9 | 29 | int initTimer; |
lorded | 8:2b0d18ebbba9 | 30 | int tasksequence; |
lorded | 8:2b0d18ebbba9 | 31 | uint16_t currentError; // default FF |
lorded | 8:2b0d18ebbba9 | 32 | char heatOn; // default 0 |
lorded | 8:2b0d18ebbba9 | 33 | wiced_bool_t primeFuelPump; |
lorded | 8:2b0d18ebbba9 | 34 | wiced_bool_t altitudeMode; |
lorded | 8:2b0d18ebbba9 | 35 | uint16_t errorHistory[8]; |
lorded | 8:2b0d18ebbba9 | 36 | unsigned char errorChangeFlag; // default 0 |
lorded | 8:2b0d18ebbba9 | 37 | char heatcontrolstate; // default 0 |
lorded | 8:2b0d18ebbba9 | 38 | int lastRequest;// default = 0; |
lorded | 8:2b0d18ebbba9 | 39 | int lastResponse;//default = 0; |
lorded | 8:2b0d18ebbba9 | 40 | int noResponseCount;//default = 0; |
lorded | 8:2b0d18ebbba9 | 41 | char retryHC;// = 0; |
lorded | 8:2b0d18ebbba9 | 42 | char heatrunning;// = 0; |
lorded | 8:2b0d18ebbba9 | 43 | char reset_fault_codes; // WICED_FALSE |
lorded | 8:2b0d18ebbba9 | 44 | wiced_bool_t isAnalogHeater; // wiced_false |
lorded | 8:2b0d18ebbba9 | 45 | volatile unsigned int tickcount; // default 0 |
lorded | 8:2b0d18ebbba9 | 46 | volatile unsigned int resettick; // default 0 |
lorded | 8:2b0d18ebbba9 | 47 | unsigned char linbuff[35]; |
lorded | 8:2b0d18ebbba9 | 48 | unsigned char linpoint;// = 0; |
lorded | 8:2b0d18ebbba9 | 49 | unsigned char working;// = 0; |
lorded | 8:2b0d18ebbba9 | 50 | volatile long heattime; //= 0 |
lorded | 8:2b0d18ebbba9 | 51 | volatile long heatresettime; |
lorded | 8:2b0d18ebbba9 | 52 | long heaterRuntime; |
lorded | 8:2b0d18ebbba9 | 53 | unsigned long setpoint; |
lorded | 8:2b0d18ebbba9 | 54 | char reportflag; //= 0- |
lorded | 8:2b0d18ebbba9 | 55 | unsigned volatile long preheattime;// = 0; |
lorded | 8:2b0d18ebbba9 | 56 | unsigned long heaterSetpointChange; |
lorded | 8:2b0d18ebbba9 | 57 | char bustype; |
lorded | 8:2b0d18ebbba9 | 58 | char heaternum; |
lorded | 8:2b0d18ebbba9 | 59 | int battV; |
lorded | 8:2b0d18ebbba9 | 60 | int altitude; |
lorded | 8:2b0d18ebbba9 | 61 | int32_t heaterTemp; |
lorded | 8:2b0d18ebbba9 | 62 | int flameTemp; |
lorded | 8:2b0d18ebbba9 | 63 | int inletTemp; |
lorded | 8:2b0d18ebbba9 | 64 | int outletTemp; |
lorded | 8:2b0d18ebbba9 | 65 | int internalAltitude; |
lorded | 8:2b0d18ebbba9 | 66 | double rawAltitude; |
lorded | 8:2b0d18ebbba9 | 67 | }; |
lorded | 8:2b0d18ebbba9 | 68 | |
lorded | 8:2b0d18ebbba9 | 69 | |
lorded | 8:2b0d18ebbba9 | 70 | #define HEATERTYPENONE 0 |
lorded | 8:2b0d18ebbba9 | 71 | #define HEATERTYPECAN 1 |
lorded | 8:2b0d18ebbba9 | 72 | #define HEATERTYPELIN 2 |
lorded | 8:2b0d18ebbba9 | 73 | |
lorded | 8:2b0d18ebbba9 | 74 | void initHeaterState(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 75 | void InitLinUart(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 76 | void InitCAN(); |
lorded | 8:2b0d18ebbba9 | 77 | void doHeatTask(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 78 | void doHeatTaskCAN(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 79 | void doHeatLogicTask(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 80 | void WakeHeater(struct sHeatVars *s); |
lorded | 8:2b0d18ebbba9 | 81 | |
lorded | 8:2b0d18ebbba9 | 82 | |
lorded | 8:2b0d18ebbba9 | 83 | void set_heat_con(struct sHeatVars* s, heatcall on_off); |
lorded | 8:2b0d18ebbba9 | 84 | void show_heat_con(void); |
lorded | 8:2b0d18ebbba9 | 85 | void resetFaultCodes(struct sHeatVars* s); |
lorded | 8:2b0d18ebbba9 | 86 | void primeFuelPump(struct sHeatVars* s); |
lorded | 8:2b0d18ebbba9 | 87 | |
lorded | 8:2b0d18ebbba9 | 88 | unsigned char get_heater_fault_code(void); |
lorded | 8:2b0d18ebbba9 | 89 | void get_heater_status_str(char * status); |
lorded | 8:2b0d18ebbba9 | 90 | void setHeatSetpoint(struct sHeatVars* s, int setpoint); |
lorded | 8:2b0d18ebbba9 | 91 | |
lorded | 8:2b0d18ebbba9 | 92 | #endif |
lorded | 8:2b0d18ebbba9 | 93 |