CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_EFI/AP_EFI_Serial_Lutan.h
Views: 1798
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
/*
16
support for Lutan serial EFI
17
*/
18
#pragma once
19
20
#include "AP_EFI_config.h"
21
22
#if AP_EFI_SERIAL_LUTAN_ENABLED
23
24
#include "AP_EFI.h"
25
#include "AP_EFI_Backend.h"
26
27
class AP_EFI_Serial_Lutan: public AP_EFI_Backend {
28
29
public:
30
// Constructor with initialization
31
AP_EFI_Serial_Lutan(AP_EFI &_frontend);
32
33
// Update the state structure
34
void update() override;
35
36
private:
37
AP_HAL::UARTDriver *port;
38
void send_request(void);
39
40
union {
41
struct PACKED {
42
// fields from channels in LUTAN-MS2.ini
43
uint16_t length;
44
uint8_t flags;
45
uint16_t seconds;
46
uint16_t pulseWidth1; // ms, scale 0.000666
47
uint16_t pulseWidth2; // ms, scale 0.000666
48
uint16_t rpm;
49
int16_t advance; // deg, scale 0.1
50
uint8_t squirt_flags;
51
uint8_t engine_flags;
52
uint8_t afrtgt1;
53
uint8_t afrtgt2;
54
uint8_t wbo2_en1;
55
uint8_t wbo2_en2;
56
int16_t barometer; // kPa, scale 0.1
57
int16_t map; // kPa, scale 0.1
58
int16_t mat; // degF, scale 0.1
59
int16_t coolant; // degF, scale 0.1
60
int16_t tps; // %, scale 0.1
61
int16_t batteryVoltage; // V, scale 0.1
62
int16_t afr1; // scale 0.1
63
int16_t afr2; // scale 0.1
64
uint16_t knock; // %, scale 0.1
65
int16_t egoCorrection1; // %, scale 0.1
66
int16_t egoCorrection2; // %, scale 0.1
67
int16_t airCorrection; // %, scale 0.1
68
int16_t warmupEnrich; // %, scale 0.1
69
int16_t accelEnrich; // ms, scale 0.1
70
int16_t tpsfuelcut; // %
71
int16_t baroCorrection; // %, scale 0.1
72
int16_t gammaEnrich; // %
73
int16_t veCurr1; // %, scale 0.1
74
int16_t veCurr2; // %, scale 0.1
75
int16_t iacstep;
76
int16_t idleDC; // scale 0.392
77
int16_t coldAdvDeg; // deg, scale 0.1
78
int16_t TPSdot; // %/s, scale 0.1
79
int16_t MAPdot; // kPa/s
80
int16_t dwell; // ms, scale 0.0666
81
} data;
82
uint8_t pkt[400];
83
};
84
uint16_t pkt_nbytes;
85
uint32_t last_request_ms;
86
uint32_t last_recv_ms;
87
};
88
89
#endif // AP_EFI_SERIAL_LUTAN_ENABLED
90
91