Skip to content

Commit 1198fc7

Browse files
committed
add Fuel consumption
1 parent a1b352d commit 1198fc7

23 files changed

Lines changed: 41710 additions & 7040 deletions

.github/workflows/unit-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Checkout submodules
3333
run: git submodule update --init --force --depth=1
3434

35+
- name: Checkout rusefi submodules
36+
run: git -C ext/rusefi submodule update --init --force --depth=1
37+
3538
- uses: actions/setup-java@v4
3639
with:
3740
distribution: 'zulu'

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to Mazduino firmware are documented here.
55
## [Unreleased]
66

77
### Added
8+
- Fuel consumption output channels: trip-average L/100km and instantaneous L/hr, user-configurable via TunerStudio (Engine > Fuel Consumption); requires VSS, injection enabled, and injector flow set
9+
- `fuelConsumptionEnabled` bit and `fuelDensity` (g/L, default 750 petrol) added to engine configuration; calculation runs in `TripOdometer::onSlowCallback()`
10+
- `OUTCH_FuelConsumptionL100km` and `OUTCH_FuelConsumptionLitersPerHour` added to `output_channel_e` enum for Lua access
11+
- `common.mk`: added `$(PROJECT_DIR)/$(META_OUTPUT_ROOT_FOLDER)controllers/generated` to `ALLINC` so the unit test build finds board-specific generated headers when `META_OUTPUT_ROOT_FOLDER` points outside the firmware tree
812
- Nightly release workflow publishing per-board .bin, .srec, and .hex artifacts as GitHub Releases
913
- Docker-based build system (`build_boards.sh`) using `--platform linux/amd64` for consistent builds on Apple Silicon and x86-64
1014
- TunerStudio UI flags in `prepend.txt` to hide ETB, traction control, boost, rotary, Harley-Davidson, torque model, and other features not applicable to each board variant
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//DO NOT EDIT MANUALLY, let automation work hard.
1+
// DO NOT EDIT MANUALLY, let automation work hard.
22

3-
// auto-generated by PinoutLogic.java based on boards/mazduino-mega100-512/connectors/can.yaml
3+
// auto-generated by PinoutLogic.java based on ../../../boards/mazduino-mega100-512/connectors/can.yaml
44
#pragma once
5+

boards/mazduino-mega100-512/connectors/generated_outputs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//DO NOT EDIT MANUALLY, let automation work hard.
1+
// DO NOT EDIT MANUALLY, let automation work hard.
22

3-
// auto-generated by PinoutLogic.java based on boards/mazduino-mega100-512/connectors/can.yaml
3+
// auto-generated by PinoutLogic.java based on ../../../boards/mazduino-mega100-512/connectors/can.yaml
44
#pragma once
55

66
Gpio GENERATED_OUTPUTS[] = {
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//DO NOT EDIT MANUALLY, let automation work hard.
1+
// DO NOT EDIT MANUALLY, let automation work hard.
22

3-
// auto-generated by PinoutLogic.java based on boards/mazduino-mega100/connectors/can.yaml
3+
// auto-generated by PinoutLogic.java based on ../../../boards/mazduino-mega100/connectors/can.yaml
44
#pragma once
5+

boards/mazduino-mega100/connectors/generated_outputs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//DO NOT EDIT MANUALLY, let automation work hard.
1+
// DO NOT EDIT MANUALLY, let automation work hard.
22

3-
// auto-generated by PinoutLogic.java based on boards/mazduino-mega100/connectors/can.yaml
3+
// auto-generated by PinoutLogic.java based on ../../../boards/mazduino-mega100/connectors/can.yaml
44
#pragma once
55

66
Gpio GENERATED_OUTPUTS[] = {

generated/console/binary/generated/data_logs.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ entry = mapPerCylinder9, "mapPerCylinder 9", int, "%d"
485485
entry = mapPerCylinder10, "mapPerCylinder 10", int, "%d"
486486
entry = mapPerCylinder11, "mapPerCylinder 11", int, "%d"
487487
entry = mapPerCylinder12, "mapPerCylinder 12", int, "%d"
488+
entry = analogMultiSwitchPosition, "Analog multi-switch position.", int, "%d"
489+
entry = analogMultiSwitchVoltage, "Analog multi-switch voltage.", float, "%.3f"
490+
entry = fuelConsumptionL100km, "Fuel: Consumption trip average", float, "%.3f"
491+
entry = fuelConsumptionLitersPerHour, "Fuel: Flow rate (instant)", float, "%.3f"
488492
entry = totalFuelCorrection, "Fuel: Total correction", float, "%.3f"
489493
entry = running_postCrankingFuelCorrection, "Fuel: Post cranking mult", float, "%.3f"
490494
entry = running_intakeTemperatureCoefficient, "Fuel: IAT correction", float, "%.3f"

generated/console/binary/generated/live_data_fragments.ini

Lines changed: 578 additions & 574 deletions
Large diffs are not rendered by default.

generated/console/binary/generated/live_data_ids.h

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -51,41 +51,41 @@ LDS_vvl_controller_state,
5151
LDS_live_data_rotational_idle,
5252
} live_data_e;
5353
#define OUTPUT_CHANNELS_BASE_ADDRESS 0
54-
#define FUEL_COMPUTER_BASE_ADDRESS 920
55-
#define IGNITION_STATE_BASE_ADDRESS 972
56-
#define KNOCK_CONTROLLER_BASE_ADDRESS 1028
57-
#define PRIME_INJECTION_BASE_ADDRESS 1140
58-
#define TCU_CONTROLLER_BASE_ADDRESS 1144
59-
#define THROTTLE_MODEL_BASE_ADDRESS 1160
60-
#define HIGH_PRESSURE_FUEL_PUMP_BASE_ADDRESS 1172
61-
#define INJECTOR_MODEL_BASE_ADDRESS 1216
62-
#define LAUNCH_CONTROL_STATE_BASE_ADDRESS 1232
63-
#define SHIFT_TORQUE_REDUCTION_STATE_BASE_ADDRESS 1240
64-
#define ANTILAG_SYSTEM_STATE_BASE_ADDRESS 1252
65-
#define BOOST_CONTROL_BASE_ADDRESS 1264
66-
#define AC_CONTROL_BASE_ADDRESS 1296
67-
#define NITROUS_CONTROL_STATE_BASE_ADDRESS 1304
68-
#define FAN_CONTROL_BASE_ADDRESS 1308
69-
#define FUEL_PUMP_CONTROL_BASE_ADDRESS 1356
70-
#define MAIN_RELAY_BASE_ADDRESS 1360
71-
#define ENGINE_STATE_BASE_ADDRESS 1364
72-
#define TPS_ACCEL_STATE_BASE_ADDRESS 1524
73-
#define TRIGGER_CENTRAL_BASE_ADDRESS 1572
74-
#define TRIGGER_STATE_BASE_ADDRESS 1644
75-
#define TRIGGER_STATE_PRIMARY_BASE_ADDRESS 1824
76-
#define WALL_FUEL_STATE_BASE_ADDRESS 1832
77-
#define CLOSED_LOOP_IDLE_BASE_ADDRESS 1840
78-
#define MISFIRE_DETECTION_STATE_BASE_ADDRESS 1848
79-
#define LIVE_DATA_EXAMPLE_BASE_ADDRESS 1876
80-
#define IDLE_STATE_BASE_ADDRESS 1880
81-
#define ELECTRONIC_THROTTLE_BASE_ADDRESS 1936
82-
#define WIDEBAND_STATE_BASE_ADDRESS 2048
83-
#define DC_MOTORS_BASE_ADDRESS 2080
84-
#define SENT_STATE_BASE_ADDRESS 2092
85-
#define VVT_BASE_ADDRESS 2100
86-
#define LAMBDA_MONITOR_BASE_ADDRESS 2104
87-
#define MC33810_STATE_BASE_ADDRESS 2112
88-
#define LONG_TERM_FUEL_TRIM_STATE_BASE_ADDRESS 2128
89-
#define SHORT_TERM_FUEL_TRIM_STATE_BASE_ADDRESS 2160
90-
#define VVL_CONTROLLER_STATE_BASE_ADDRESS 2176
91-
#define LIVE_DATA_ROTATIONAL_IDLE_BASE_ADDRESS 2180
54+
#define FUEL_COMPUTER_BASE_ADDRESS 928
55+
#define IGNITION_STATE_BASE_ADDRESS 980
56+
#define KNOCK_CONTROLLER_BASE_ADDRESS 1036
57+
#define PRIME_INJECTION_BASE_ADDRESS 1148
58+
#define TCU_CONTROLLER_BASE_ADDRESS 1152
59+
#define THROTTLE_MODEL_BASE_ADDRESS 1168
60+
#define HIGH_PRESSURE_FUEL_PUMP_BASE_ADDRESS 1180
61+
#define INJECTOR_MODEL_BASE_ADDRESS 1224
62+
#define LAUNCH_CONTROL_STATE_BASE_ADDRESS 1240
63+
#define SHIFT_TORQUE_REDUCTION_STATE_BASE_ADDRESS 1248
64+
#define ANTILAG_SYSTEM_STATE_BASE_ADDRESS 1260
65+
#define BOOST_CONTROL_BASE_ADDRESS 1272
66+
#define AC_CONTROL_BASE_ADDRESS 1304
67+
#define NITROUS_CONTROL_STATE_BASE_ADDRESS 1312
68+
#define FAN_CONTROL_BASE_ADDRESS 1316
69+
#define FUEL_PUMP_CONTROL_BASE_ADDRESS 1364
70+
#define MAIN_RELAY_BASE_ADDRESS 1368
71+
#define ENGINE_STATE_BASE_ADDRESS 1372
72+
#define TPS_ACCEL_STATE_BASE_ADDRESS 1532
73+
#define TRIGGER_CENTRAL_BASE_ADDRESS 1580
74+
#define TRIGGER_STATE_BASE_ADDRESS 1652
75+
#define TRIGGER_STATE_PRIMARY_BASE_ADDRESS 1832
76+
#define WALL_FUEL_STATE_BASE_ADDRESS 1840
77+
#define CLOSED_LOOP_IDLE_BASE_ADDRESS 1848
78+
#define MISFIRE_DETECTION_STATE_BASE_ADDRESS 1856
79+
#define LIVE_DATA_EXAMPLE_BASE_ADDRESS 1884
80+
#define IDLE_STATE_BASE_ADDRESS 1888
81+
#define ELECTRONIC_THROTTLE_BASE_ADDRESS 1944
82+
#define WIDEBAND_STATE_BASE_ADDRESS 2056
83+
#define DC_MOTORS_BASE_ADDRESS 2088
84+
#define SENT_STATE_BASE_ADDRESS 2100
85+
#define VVT_BASE_ADDRESS 2108
86+
#define LAMBDA_MONITOR_BASE_ADDRESS 2112
87+
#define MC33810_STATE_BASE_ADDRESS 2120
88+
#define LONG_TERM_FUEL_TRIM_STATE_BASE_ADDRESS 2136
89+
#define SHORT_TERM_FUEL_TRIM_STATE_BASE_ADDRESS 2168
90+
#define VVL_CONTROLLER_STATE_BASE_ADDRESS 2184
91+
#define LIVE_DATA_ROTATIONAL_IDLE_BASE_ADDRESS 2188

generated/console/binary/generated/log_fields_generated.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ static LOG_FIELD_CONSTNESS_SPECIFIER_STORAGE MLG::Entries::Field fields[] = {
469469
{engine->outputChannels.mapPerCylinder[9], "mapPerCylinder 10", "kPa", 0},
470470
{engine->outputChannels.mapPerCylinder[10], "mapPerCylinder 11", "kPa", 0},
471471
{engine->outputChannels.mapPerCylinder[11], "mapPerCylinder 12", "kPa", 0},
472+
{engine->outputChannels.analogMultiSwitchPosition, "Analog multi-switch position.", "", 0},
473+
{engine->outputChannels.analogMultiSwitchVoltage, "Analog multi-switch voltage.", "V", 3},
474+
{engine->outputChannels.fuelConsumptionL100km, "Fuel: Consumption trip average", "L/100km", 1},
475+
{engine->outputChannels.fuelConsumptionLitersPerHour, "Fuel: Flow rate (instant)", "L/hr", 2},
472476
{engine->ignitionState.baseDwell, "Ignition: base dwell", "ms", 1, "Timing"},
473477
{engine->ignitionState.sparkDwell, "Ignition: coil charge time", "ms", 1, "Timing"},
474478
{engine->ignitionState.dwellDurationAngle, "Ignition: dwell duration", "deg", 1, "Timing"},

0 commit comments

Comments
 (0)