mirror of https://github.com/FOME-Tech/fome-fw.git
Merge branch 'master' into custom-chrono
This commit is contained in:
commit
37859cf190
|
@ -77,7 +77,7 @@ void AlternatorController::setOutput(expected<percent_t> outputValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlternatorController::onConfigurationChange(engine_configuration_s const * previousConfiguration) {
|
void AlternatorController::onConfigurationChange(engine_configuration_s const * previousConfiguration) {
|
||||||
if(!alternatorPid.isSame(&previousConfiguration->alternatorControl)) {
|
if(!previousConfiguration || !alternatorPid.isSame(&previousConfiguration->alternatorControl)) {
|
||||||
alternatorPid.reset();
|
alternatorPid.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#error "Unexpected OS ACCESS HERE"
|
#error "Unexpected OS ACCESS HERE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static boostOpenLoop_Map3D_t boostMapOpen;
|
static Map3D<BOOST_RPM_COUNT, BOOST_LOAD_COUNT, uint8_t, uint8_t, uint8_t> boostMapOpen;
|
||||||
static boostOpenLoop_Map3D_t boostMapClosed;
|
static Map3D<BOOST_RPM_COUNT, BOOST_LOAD_COUNT, uint8_t, uint8_t, uint8_t> boostMapClosed;
|
||||||
static SimplePwm boostPwmControl("boost");
|
static SimplePwm boostPwmControl("boost");
|
||||||
|
|
||||||
void BoostController::init(IPwm* pwm, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams) {
|
void BoostController::init(IPwm* pwm, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams) {
|
||||||
|
@ -39,7 +39,7 @@ void BoostController::resetLua() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoostController::onConfigurationChange(engine_configuration_s const * previousConfig) {
|
void BoostController::onConfigurationChange(engine_configuration_s const * previousConfig) {
|
||||||
if (!m_pid.isSame(&previousConfig->boostPid)) {
|
if (!previousConfig || !m_pid.isSame(&previousConfig->boostPid)) {
|
||||||
m_shouldResetPid = true;
|
m_shouldResetPid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
#endif /* ETB_MAX_COUNT */
|
#endif /* ETB_MAX_COUNT */
|
||||||
|
|
||||||
static pedal2tps_t pedal2tpsMap;
|
static pedal2tps_t pedal2tpsMap;
|
||||||
static Map3D<6, 6, int8_t, uint8_t, uint8_t> throttle2TrimTable;
|
|
||||||
|
|
||||||
constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY;
|
constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY;
|
||||||
|
|
||||||
|
@ -357,7 +356,11 @@ float EtbController::getLuaAdjustment() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
percent_t EtbController2::getThrottleTrim(float rpm, percent_t targetPosition) const {
|
percent_t EtbController2::getThrottleTrim(float rpm, percent_t targetPosition) const {
|
||||||
return m_throttle2Trim.getValue(rpm, targetPosition);
|
return interpolate3d(
|
||||||
|
config->throttle2TrimTable,
|
||||||
|
config->throttle2TrimTpsBins, targetPosition,
|
||||||
|
config->throttle2TrimRpmBins, rpm
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
expected<percent_t> EtbController::getOpenLoop(percent_t target) {
|
expected<percent_t> EtbController::getOpenLoop(percent_t target) {
|
||||||
|
@ -746,7 +749,7 @@ struct EtbImpl final : public TBase {
|
||||||
|
|
||||||
// real implementation (we mock for some unit tests)
|
// real implementation (we mock for some unit tests)
|
||||||
static EtbImpl<EtbController1> etb1;
|
static EtbImpl<EtbController1> etb1;
|
||||||
static EtbImpl<EtbController2> etb2(throttle2TrimTable);
|
static EtbImpl<EtbController2> etb2;
|
||||||
|
|
||||||
static_assert(ETB_COUNT == 2);
|
static_assert(ETB_COUNT == 2);
|
||||||
static EtbController* etbControllers[] = { &etb1, &etb2 };
|
static EtbController* etbControllers[] = { &etb1, &etb2 };
|
||||||
|
@ -1011,7 +1014,6 @@ void initElectronicThrottle() {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
|
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
|
||||||
throttle2TrimTable.init(config->throttle2TrimTable, config->throttle2TrimTpsBins, config->throttle2TrimRpmBins);
|
|
||||||
|
|
||||||
doInitElectronicThrottle();
|
doInitElectronicThrottle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
virtual void setWastegatePosition(percent_t pos) = 0;
|
virtual void setWastegatePosition(percent_t pos) = 0;
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
virtual void autoCalibrateTps() = 0;
|
virtual void autoCalibrateTps() = 0;
|
||||||
virtual bool isEtbMode() = 0;
|
virtual bool isEtbMode() const = 0;
|
||||||
|
|
||||||
virtual const pid_state_s& getPidState() const = 0;
|
virtual const pid_state_s& getPidState() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ private:
|
||||||
* @return true if OK, false if should be disabled
|
* @return true if OK, false if should be disabled
|
||||||
*/
|
*/
|
||||||
bool checkStatus();
|
bool checkStatus();
|
||||||
bool isEtbMode() {
|
bool isEtbMode() const override {
|
||||||
return m_function == DC_Throttle1 || m_function == DC_Throttle2;
|
return m_function == DC_Throttle1 || m_function == DC_Throttle2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,13 +137,5 @@ class EtbController1 : public EtbController { };
|
||||||
|
|
||||||
class EtbController2 : public EtbController {
|
class EtbController2 : public EtbController {
|
||||||
public:
|
public:
|
||||||
EtbController2(const ValueProvider3D& throttle2TrimTable)
|
percent_t getThrottleTrim(float rpm, percent_t targetPosition) const override;
|
||||||
: m_throttle2Trim(throttle2TrimTable)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
percent_t getThrottleTrim(float rpm, percent_t /*targetPosition*/) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const ValueProvider3D& m_throttle2Trim;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,12 +7,14 @@ static GppwmChannel channels[GPPWM_CHANNELS];
|
||||||
static OutputPin pins[GPPWM_CHANNELS];
|
static OutputPin pins[GPPWM_CHANNELS];
|
||||||
static SimplePwm outputs[GPPWM_CHANNELS];
|
static SimplePwm outputs[GPPWM_CHANNELS];
|
||||||
|
|
||||||
|
using gppwm_Map3D_t = Map3D<GPPWM_RPM_COUNT, GPPWM_LOAD_COUNT, uint8_t, int16_t, int16_t>;
|
||||||
|
|
||||||
static gppwm_Map3D_t table1;
|
static gppwm_Map3D_t table1;
|
||||||
static gppwm_Map3D_t table2;
|
static gppwm_Map3D_t table2;
|
||||||
static gppwm_Map3D_t table3;
|
static gppwm_Map3D_t table3;
|
||||||
static gppwm_Map3D_t table4;
|
static gppwm_Map3D_t table4;
|
||||||
|
|
||||||
static gppwm_Map3D_t* tables[] = {
|
static gppwm_Map3D_t* const tables[] = {
|
||||||
&table1,
|
&table1,
|
||||||
&table2,
|
&table2,
|
||||||
&table3,
|
&table3,
|
||||||
|
|
|
@ -376,7 +376,7 @@ void IdleController::onSlowCallback() {
|
||||||
|
|
||||||
void IdleController::onConfigurationChange(engine_configuration_s const * previousConfiguration) {
|
void IdleController::onConfigurationChange(engine_configuration_s const * previousConfiguration) {
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
shouldResetPid = !getIdlePid()->isSame(&previousConfiguration->idleRpmPid);
|
shouldResetPid = !previousConfiguration || !getIdlePid()->isSame(&previousConfiguration->idleRpmPid);
|
||||||
mustResetPid = shouldResetPid;
|
mustResetPid = shouldResetPid;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ void VvtController::onFastCallback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VvtController::onConfigurationChange(engine_configuration_s const * previousConfig) {
|
void VvtController::onConfigurationChange(engine_configuration_s const * previousConfig) {
|
||||||
if (!m_pid.isSame(&previousConfig->auxPid[m_cam])) {
|
if (!previousConfig || !m_pid.isSame(&previousConfig->auxPid[m_cam])) {
|
||||||
m_pid.reset();
|
m_pid.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define VCS_DATE 20240427
|
#define VCS_DATE 20240503
|
||||||
|
|
|
@ -8,12 +8,6 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "knock_logic.h"
|
#include "knock_logic.h"
|
||||||
|
|
||||||
void KnockController::onConfigurationChange(engine_configuration_s const * previousConfig) {
|
|
||||||
KnockControllerBase::onConfigurationChange(previousConfig);
|
|
||||||
|
|
||||||
m_maxRetardTable.init(config->maxKnockRetardTable, config->maxKnockRetardRpmBins, config->maxKnockRetardLoadBins);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getCylinderKnockBank(uint8_t cylinderNumber) {
|
int getCylinderKnockBank(uint8_t cylinderNumber) {
|
||||||
// C/C++ can't index in to bit fields, we have to provide lookup ourselves
|
// C/C++ can't index in to bit fields, we have to provide lookup ourselves
|
||||||
switch (cylinderNumber) {
|
switch (cylinderNumber) {
|
||||||
|
@ -122,7 +116,12 @@ float KnockController::getKnockThreshold() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float KnockController::getMaximumRetard() const {
|
float KnockController::getMaximumRetard() const {
|
||||||
return m_maxRetardTable.getValue(Sensor::getOrZero(SensorType::Rpm), getIgnitionLoad());
|
return
|
||||||
|
interpolate3d(
|
||||||
|
config->maxKnockRetardTable,
|
||||||
|
config->maxKnockRetardLoadBins, getIgnitionLoad(),
|
||||||
|
config->maxKnockRetardRpmBins, Sensor::getOrZero(SensorType::Rpm)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is to be implemented by the knock sense driver
|
// This callback is to be implemented by the knock sense driver
|
||||||
|
|
|
@ -42,11 +42,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void onConfigurationChange(engine_configuration_s const * /*previousConfig*/) override;
|
|
||||||
|
|
||||||
float getKnockThreshold() const override;
|
float getKnockThreshold() const override;
|
||||||
float getMaximumRetard() const override;
|
float getMaximumRetard() const override;
|
||||||
|
|
||||||
private:
|
|
||||||
Map3D<6, 6, uint8_t, uint8_t, uint8_t> m_maxRetardTable;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.alphax-2chan.2754411786"
|
signature = "rusEFI (FOME) master.2024.05.04.alphax-2chan.2754411786"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.alphax-2chan.2754411786" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.alphax-2chan.2754411786" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.alphax-4chan.786759531"
|
signature = "rusEFI (FOME) master.2024.05.04.alphax-4chan.786759531"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.alphax-4chan.786759531" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.alphax-4chan.786759531" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.alphax-8chan.1449130386"
|
signature = "rusEFI (FOME) master.2024.05.04.alphax-8chan.1449130386"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.alphax-8chan.1449130386" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.alphax-8chan.1449130386" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.atlas.3592250925"
|
signature = "rusEFI (FOME) master.2024.05.04.atlas.3592250925"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.atlas.3592250925" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.atlas.3592250925" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.core48.2653811384"
|
signature = "rusEFI (FOME) master.2024.05.04.core48.2653811384"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.core48.2653811384" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.core48.2653811384" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.core8.3109353339"
|
signature = "rusEFI (FOME) master.2024.05.04.core8.3109353339"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.core8.3109353339" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.core8.3109353339" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.f407-discovery.1614642093"
|
signature = "rusEFI (FOME) master.2024.05.04.f407-discovery.1614642093"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.f407-discovery.1614642093" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.f407-discovery.1614642093" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.f429-discovery.2171861709"
|
signature = "rusEFI (FOME) master.2024.05.04.f429-discovery.2171861709"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.f429-discovery.2171861709" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.f429-discovery.2171861709" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.frankenso_na6.2736855559"
|
signature = "rusEFI (FOME) master.2024.05.04.frankenso_na6.2736855559"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.frankenso_na6.2736855559" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.frankenso_na6.2736855559" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.harley81.149340855"
|
signature = "rusEFI (FOME) master.2024.05.04.harley81.149340855"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.harley81.149340855" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.harley81.149340855" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen-gm-e67.3894072350"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen-gm-e67.3894072350"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen-gm-e67.3894072350" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen-gm-e67.3894072350" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen-honda-k.1938496095"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen-honda-k.1938496095"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen-honda-k.1938496095" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen-honda-k.1938496095" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen-nb1.1985276785"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen-nb1.1985276785"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen-nb1.1985276785" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen-nb1.1985276785" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen121nissan.110053179"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen121nissan.110053179"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen121nissan.110053179" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen121nissan.110053179" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen121vag.2861320424"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen121vag.2861320424"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen121vag.2861320424" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen121vag.2861320424" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen128.31562602"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen128.31562602"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen128.31562602" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen128.31562602" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen154hyundai.2501294987"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen154hyundai.2501294987"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen154hyundai.2501294987" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen154hyundai.2501294987" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen72.1892115322"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen72.1892115322"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen72.1892115322" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen72.1892115322" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen81.3696040440"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen81.3696040440"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen81.3696040440" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen81.3696040440" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellen88bmw.3665104587"
|
signature = "rusEFI (FOME) master.2024.05.04.hellen88bmw.3665104587"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellen88bmw.3665104587" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellen88bmw.3665104587" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellenNA6.2462301002"
|
signature = "rusEFI (FOME) master.2024.05.04.hellenNA6.2462301002"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellenNA6.2462301002" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellenNA6.2462301002" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.hellenNA8_96.778554618"
|
signature = "rusEFI (FOME) master.2024.05.04.hellenNA8_96.778554618"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.hellenNA8_96.778554618" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.hellenNA8_96.778554618" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.mre_f4.1727897461"
|
signature = "rusEFI (FOME) master.2024.05.04.mre_f4.1727897461"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.mre_f4.1727897461" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.mre_f4.1727897461" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.mre_f7.1727897461"
|
signature = "rusEFI (FOME) master.2024.05.04.mre_f7.1727897461"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.mre_f7.1727897461" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.mre_f7.1727897461" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.prometheus_405.2984720221"
|
signature = "rusEFI (FOME) master.2024.05.04.prometheus_405.2984720221"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.prometheus_405.2984720221" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.prometheus_405.2984720221" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.prometheus_469.2984720221"
|
signature = "rusEFI (FOME) master.2024.05.04.prometheus_469.2984720221"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.prometheus_469.2984720221" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.prometheus_469.2984720221" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.proteus_f4.3679021848"
|
signature = "rusEFI (FOME) master.2024.05.04.proteus_f4.3679021848"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.proteus_f4.3679021848" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.proteus_f4.3679021848" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.proteus_f7.3679021848"
|
signature = "rusEFI (FOME) master.2024.05.04.proteus_f7.3679021848"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.proteus_f7.3679021848" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.proteus_f7.3679021848" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.proteus_h7.3679021848"
|
signature = "rusEFI (FOME) master.2024.05.04.proteus_h7.3679021848"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.proteus_h7.3679021848" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.proteus_h7.3679021848" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.small-can-board.1763700051"
|
signature = "rusEFI (FOME) master.2024.05.04.small-can-board.1763700051"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.small-can-board.1763700051" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.small-can-board.1763700051" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
[MegaTune]
|
[MegaTune]
|
||||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||||
signature = "rusEFI (FOME) master.2024.04.27.tdg-pdm8.199087855"
|
signature = "rusEFI (FOME) master.2024.05.04.tdg-pdm8.199087855"
|
||||||
|
|
||||||
[TunerStudio]
|
[TunerStudio]
|
||||||
queryCommand = "S"
|
queryCommand = "S"
|
||||||
versionInfo = "V" ; firmware version for title bar.
|
versionInfo = "V" ; firmware version for title bar.
|
||||||
signature= "rusEFI (FOME) master.2024.04.27.tdg-pdm8.199087855" ; signature is expected to be 7 or more characters.
|
signature= "rusEFI (FOME) master.2024.05.04.tdg-pdm8.199087855" ; signature is expected to be 7 or more characters.
|
||||||
|
|
||||||
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
|
||||||
useLegacyFTempUnits = false
|
useLegacyFTempUnits = false
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
ifeq ($(TRGT),)
|
ifeq ($(TRGT),)
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_SM := $(shell uname -sm)
|
||||||
UNAME_SP := $(shell uname -sp)
|
$(info UNAME_SM: $(UNAME_SM))
|
||||||
$(info UNAME_SP: $(UNAME_SP))
|
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(firstword $(UNAME_SM)),Darwin)
|
||||||
COMPILER_PLATFORM = arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
|
COMPILER_PLATFORM = arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
|
||||||
else ifeq ($(UNAME_SP),Linux x86_64)
|
else ifeq ($(UNAME_SM),Linux x86_64)
|
||||||
COMPILER_PLATFORM = arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi
|
COMPILER_PLATFORM = arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi
|
||||||
else
|
else
|
||||||
$(error Looks like your platform, $(UNAME_SP), doesn't have a supported compiler!)
|
$(error Looks like your platform, $(UNAME_SM), doesn't have a supported compiler!)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_TOOLS_DIR = $(PROJECT_DIR)/ext/build-tools/
|
BUILD_TOOLS_DIR = $(PROJECT_DIR)/ext/build-tools/
|
||||||
|
|
|
@ -118,13 +118,8 @@ private:
|
||||||
float m_valueMult = 1;
|
float m_valueMult = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint8_t, uint16_t, uint16_t> lambda_Map3D_t;
|
|
||||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> fuel_Map3D_t;
|
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> fuel_Map3D_t;
|
||||||
typedef Map3D<BARO_CORR_SIZE, BARO_CORR_SIZE, float, float, float> baroCorr_Map3D_t;
|
|
||||||
typedef Map3D<PEDAL_TO_TPS_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t, uint8_t> pedal2tps_t;
|
typedef Map3D<PEDAL_TO_TPS_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t, uint8_t> pedal2tps_t;
|
||||||
typedef Map3D<BOOST_RPM_COUNT, BOOST_LOAD_COUNT, uint8_t, uint8_t, uint8_t> boostOpenLoop_Map3D_t;
|
|
||||||
typedef Map3D<BOOST_RPM_COUNT, BOOST_LOAD_COUNT, uint8_t, uint8_t, uint8_t> boostClosedLoop_Map3D_t;
|
|
||||||
typedef Map3D<GPPWM_RPM_COUNT, GPPWM_LOAD_COUNT, uint8_t, int16_t, int16_t> gppwm_Map3D_t;
|
|
||||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> mapEstimate_Map3D_t;
|
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> mapEstimate_Map3D_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ public class Fields {
|
||||||
public static final int TS_RESPONSE_UNDERRUN = 0x80;
|
public static final int TS_RESPONSE_UNDERRUN = 0x80;
|
||||||
public static final int TS_RESPONSE_UNRECOGNIZED_COMMAND = 0x83;
|
public static final int TS_RESPONSE_UNRECOGNIZED_COMMAND = 0x83;
|
||||||
public static final char TS_SET_LOGGER_SWITCH = 'l';
|
public static final char TS_SET_LOGGER_SWITCH = 'l';
|
||||||
public static final String TS_SIGNATURE = "rusEFI (FOME) master.2024.04.27.f407-discovery.1614642093";
|
public static final String TS_SIGNATURE = "rusEFI (FOME) master.2024.05.04.f407-discovery.1614642093";
|
||||||
public static final char TS_SINGLE_WRITE_COMMAND = 'W';
|
public static final char TS_SINGLE_WRITE_COMMAND = 'W';
|
||||||
public static final char TS_TEST_COMMAND = 't';
|
public static final char TS_TEST_COMMAND = 't';
|
||||||
public static final int TS_TOTAL_OUTPUT_SIZE = 1388;
|
public static final int TS_TOTAL_OUTPUT_SIZE = 1388;
|
||||||
|
|
|
@ -365,7 +365,7 @@ public class ParseState implements DefinitionsState {
|
||||||
|
|
||||||
// First check if this is an instance of a struct
|
// First check if this is an instance of a struct
|
||||||
if (structs.containsKey(type)) {
|
if (structs.containsKey(type)) {
|
||||||
scope.structFields.add(new StructField(structs.get(type), name));
|
scope.addField(new StructField(structs.get(type), name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,14 +388,14 @@ public class ParseState implements DefinitionsState {
|
||||||
// Merge the read-in options list with the default from the typedef (if exists)
|
// Merge the read-in options list with the default from the typedef (if exists)
|
||||||
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
||||||
|
|
||||||
scope.structFields.add(new EnumField(bTypedef.type, type, name, bTypedef.endBit, bTypedef.values, options));
|
scope.addField(new EnumField(bTypedef.type, type, name, bTypedef.endBit, bTypedef.values, options));
|
||||||
return;
|
return;
|
||||||
} else if (typedef instanceof StringTypedef) {
|
} else if (typedef instanceof StringTypedef) {
|
||||||
options = new FieldOptions();
|
options = new FieldOptions();
|
||||||
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
||||||
|
|
||||||
StringTypedef sTypedef = (StringTypedef) typedef;
|
StringTypedef sTypedef = (StringTypedef) typedef;
|
||||||
scope.structFields.add(new StringField(name, sTypedef.size, options.comment));
|
scope.addField(new StringField(name, sTypedef.size, options.comment));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// TODO: throw
|
// TODO: throw
|
||||||
|
@ -413,7 +413,7 @@ public class ParseState implements DefinitionsState {
|
||||||
// Merge the read-in options list with the default from the typedef (if exists)
|
// Merge the read-in options list with the default from the typedef (if exists)
|
||||||
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
||||||
|
|
||||||
scope.structFields.add(new ScalarField(Type.findByCtype(type).get(), name, options, autoscale));
|
scope.addField(new ScalarField(Type.findByCtype(type).get(), name, options, autoscale));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -438,7 +438,7 @@ public class ParseState implements DefinitionsState {
|
||||||
// there was no group, create and add it
|
// there was no group, create and add it
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
group = new BitGroup();
|
group = new BitGroup();
|
||||||
scope.structFields.add(group);
|
scope.addField(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
String comment = ctx.SemicolonedSuffix() == null ? null : ctx.SemicolonedSuffix().getText().substring(1).trim();
|
String comment = ctx.SemicolonedSuffix() == null ? null : ctx.SemicolonedSuffix().getText().substring(1).trim();
|
||||||
|
@ -499,7 +499,7 @@ public class ParseState implements DefinitionsState {
|
||||||
// iterate required for structs
|
// iterate required for structs
|
||||||
assert(iterate);
|
assert(iterate);
|
||||||
|
|
||||||
scope.structFields.add(new ArrayField<>(new StructField(structs.get(type), name), length, iterate));
|
scope.addField(new ArrayField<>(new StructField(structs.get(type), name), length, iterate));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ public class ParseState implements DefinitionsState {
|
||||||
|
|
||||||
EnumField prototype = new EnumField(bTypedef.type, type, name, bTypedef.endBit, bTypedef.values, options);
|
EnumField prototype = new EnumField(bTypedef.type, type, name, bTypedef.endBit, bTypedef.values, options);
|
||||||
|
|
||||||
scope.structFields.add(new ArrayField<>(prototype, length, iterate));
|
scope.addField(new ArrayField<>(prototype, length, iterate));
|
||||||
return;
|
return;
|
||||||
} else if (typedef instanceof StringTypedef) {
|
} else if (typedef instanceof StringTypedef) {
|
||||||
StringTypedef sTypedef = (StringTypedef) typedef;
|
StringTypedef sTypedef = (StringTypedef) typedef;
|
||||||
|
@ -534,7 +534,7 @@ public class ParseState implements DefinitionsState {
|
||||||
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
handleFieldOptionsList(options, ctx.fieldOptionsList());
|
||||||
|
|
||||||
StringField prototype = new StringField(name, sTypedef.size, options.comment);
|
StringField prototype = new StringField(name, sTypedef.size, options.comment);
|
||||||
scope.structFields.add(new ArrayField<>(prototype, length, iterate));
|
scope.addField(new ArrayField<>(prototype, length, iterate));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("didn't understand type " + type + " for element " + name);
|
throw new RuntimeException("didn't understand type " + type + " for element " + name);
|
||||||
|
@ -554,7 +554,7 @@ public class ParseState implements DefinitionsState {
|
||||||
|
|
||||||
ScalarField prototype = new ScalarField(Type.findByCtype(type).get(), name, options, autoscale);
|
ScalarField prototype = new ScalarField(Type.findByCtype(type).get(), name, options, autoscale);
|
||||||
|
|
||||||
scope.structFields.add(new ArrayField<>(prototype, length, iterate));
|
scope.addField(new ArrayField<>(prototype, length, iterate));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] arrayDim = null;
|
private int[] arrayDim = null;
|
||||||
|
@ -572,7 +572,7 @@ public class ParseState implements DefinitionsState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enterUnusedField(RusefiConfigGrammarParser.UnusedFieldContext ctx) {
|
public void enterUnusedField(RusefiConfigGrammarParser.UnusedFieldContext ctx) {
|
||||||
scope.structFields.add(new UnusedField(Integer.parseInt(ctx.integer().getText())));
|
scope.addField(new UnusedField(Integer.parseInt(ctx.integer().getText())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -609,7 +609,7 @@ public class ParseState implements DefinitionsState {
|
||||||
scope = scopes.pop();
|
scope = scopes.pop();
|
||||||
|
|
||||||
// Lastly, add the union to the scope
|
// Lastly, add the union to the scope
|
||||||
scope.structFields.add(u);
|
scope.addField(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Stack<Double> evalStack = new Stack<>();
|
private final Stack<Double> evalStack = new Stack<>();
|
||||||
|
@ -681,5 +681,11 @@ public class ParseState implements DefinitionsState {
|
||||||
|
|
||||||
static class Scope {
|
static class Scope {
|
||||||
public final List<Field> structFields = new ArrayList<>();
|
public final List<Field> structFields = new ArrayList<>();
|
||||||
|
|
||||||
|
public void addField(Field f) {
|
||||||
|
// TODO: check for duplicate fields
|
||||||
|
|
||||||
|
structFields.add(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.*;
|
import com.rusefi.newparse.parsing.*;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
@ -10,24 +10,12 @@ public class ArrayIterateScalarLayout extends ArrayLayout {
|
||||||
super(prototype, length);
|
super(prototype, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emitOne(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offset, int idx) {
|
|
||||||
// Set element's position within the array
|
|
||||||
this.prototypeLayout.setOffset(offset + this.prototypeLayout.getSize() * idx);
|
|
||||||
|
|
||||||
// Put a 1-based index on the end of the name to distinguish in TS
|
|
||||||
prefixer.setIndex(idx);
|
|
||||||
this.prototypeLayout.writeTunerstudioLayout(ps, meta, prefixer, 0);
|
|
||||||
prefixer.clearIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
// Time to iterate: emit one scalar per array element, with the name modified accordingly
|
if (arrayDims.length != 0) {
|
||||||
|
throw new IllegalStateException("ArrayIterateScalarLayout got called with array dims?");
|
||||||
for (int i = 0; i < this.length[0]; i++) {
|
|
||||||
emitOne(ps, meta, prefixer, this.offset + offsetAdd, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// C layout is the same if iterated or not, use default implementation
|
v.visit(this, ps, pfx, offsetAdd, this.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.*;
|
import com.rusefi.newparse.parsing.*;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
@ -10,34 +10,12 @@ public class ArrayIterateStructLayout extends ArrayLayout {
|
||||||
super(prototype, length);
|
super(prototype, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emitOne(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offset, int idx) {
|
|
||||||
// Set element's position within the array
|
|
||||||
int offsetAdd = offset + this.prototypeLayout.getSize() * idx;
|
|
||||||
|
|
||||||
// Put a 1-based index on the end of the name to distinguish in TS
|
|
||||||
prefixer.setIndex(idx);
|
|
||||||
this.prototypeLayout.writeTunerstudioLayout(ps, meta, prefixer, offsetAdd);
|
|
||||||
prefixer.clearIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
// Time to iterate: emit one scalar per array element, with the name modified accordingly
|
if (arrayDims.length != 0) {
|
||||||
|
throw new IllegalStateException("ArrayIterateStructLayout got called with array dims?");
|
||||||
for (int i = 0; i < this.length[0]; i++) {
|
|
||||||
emitOne(ps, meta, prefixer, this.offset + offsetAdd, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
v.visit(this, ps, pfx, offsetAdd, this.length);
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
for (int i = 0; i < this.length[0]; i++) {
|
|
||||||
// Put a 1-based index on the end of the name to distinguish in TS
|
|
||||||
prefixer.setIndex(i);
|
|
||||||
this.prototypeLayout.writeOutputChannelLayout(ps, psDatalog, prefixer, this.offset + offsetAdd + this.prototypeLayout.getSize() * i);
|
|
||||||
prefixer.clearIndex();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// C layout is the same if iterated or not, use default implementation
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.*;
|
import com.rusefi.newparse.parsing.*;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class ArrayLayout extends Layout {
|
public class ArrayLayout extends Layout {
|
||||||
protected final int[] length;
|
public final int[] length;
|
||||||
|
|
||||||
protected final Layout prototypeLayout;
|
public final Layout prototypeLayout;
|
||||||
|
|
||||||
public ArrayLayout(PrototypeField prototype, int[] length) {
|
public ArrayLayout(PrototypeField prototype, int[] length) {
|
||||||
this.length = length;
|
this.length = length;
|
||||||
|
@ -61,31 +61,17 @@ public class ArrayLayout extends Layout {
|
||||||
return "Array of " + this.prototypeLayout + " length " + this.length[0] + " " + super.toString();
|
return "Array of " + this.prototypeLayout + " length " + this.length[0] + " " + super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
this.prototypeLayout.writeTunerstudioLayout(ps, meta, prefixer, offsetAdd, this.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
// Skip zero length arrays, they may be used for padding
|
|
||||||
if (this.length[0] > 0) {
|
|
||||||
this.prototypeLayout.writeCLayout(ps, this.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
||||||
this.prototypeLayout.writeCOffsetCheck(ps, parentTypeName);
|
this.prototypeLayout.writeCOffsetCheck(ps, parentTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
this.prototypeLayout.writeOutputChannelLayout(ps, psDatalog, prefixer, offsetAdd, this.length);
|
if (arrayDims.length != 0) {
|
||||||
|
throw new IllegalStateException("ArrayLayout got called with array dims?");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName) {
|
|
||||||
this.prototypeLayout.writeSdLogLayout(ps, prefixer, sourceName, this.length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.BitGroup;
|
import com.rusefi.newparse.parsing.BitGroup;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class BitGroupLayout extends Layout {
|
public class BitGroupLayout extends Layout {
|
||||||
private static class BitLayout {
|
public static class BitLayout {
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String comment;
|
public final String comment;
|
||||||
public final String trueValue;
|
public final String trueValue;
|
||||||
|
@ -22,7 +22,7 @@ public class BitGroupLayout extends Layout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<BitLayout> bits;
|
public final List<BitLayout> bits;
|
||||||
|
|
||||||
public BitGroupLayout(BitGroup bitGroup) {
|
public BitGroupLayout(BitGroup bitGroup) {
|
||||||
int size = bitGroup.bitFields.size();
|
int size = bitGroup.bitFields.size();
|
||||||
|
@ -44,77 +44,7 @@ public class BitGroupLayout extends Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
int actualOffset = this.offset + offsetAdd;
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
|
|
||||||
for (int i = 0; i < bits.size(); i++) {
|
|
||||||
BitLayout bit = bits.get(i);
|
|
||||||
|
|
||||||
String name = prefixer.get(bit.name);
|
|
||||||
|
|
||||||
ps.print(name);
|
|
||||||
ps.print(" = bits, U32, ");
|
|
||||||
ps.print(actualOffset);
|
|
||||||
ps.print(", [");
|
|
||||||
ps.print(i + ":" + i);
|
|
||||||
|
|
||||||
ps.print("], " + bit.falseValue + ", " + bit.trueValue);
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
|
|
||||||
meta.addComment(name, bit.comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
// always emit all 32 bits
|
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
if (i < bits.size()) {
|
|
||||||
BitLayout bit = this.bits.get(i);
|
|
||||||
|
|
||||||
if (bit.comment != null) {
|
|
||||||
ps.println("\t// " + bit.comment.replaceAll("[+]", "").replaceAll(";", "").replace("\\n", "\n\t// "));
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.println("\t// offset " + this.offsetWithinStruct + " bit " + i);
|
|
||||||
ps.println("\tbool " + bit.name + " : 1 {};");
|
|
||||||
} else {
|
|
||||||
// Force pad out all bit groups to a full 32b/4B
|
|
||||||
ps.println("\t// offset " + this.offsetWithinStruct + " bit " + i);
|
|
||||||
ps.println("\tbool unusedBit_" + this.offsetWithinStruct + "_" + i + " : 1 {};");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
int actualOffset = this.offset + offsetAdd;
|
|
||||||
|
|
||||||
for (int i = 0; i < bits.size(); i++) {
|
|
||||||
BitLayout bit = bits.get(i);
|
|
||||||
|
|
||||||
String name = prefixer.get(bit.name);
|
|
||||||
ps.print(name);
|
|
||||||
ps.print(" = bits, U32, ");
|
|
||||||
ps.print(actualOffset);
|
|
||||||
ps.print(", [");
|
|
||||||
ps.print(i + ":" + i);
|
|
||||||
|
|
||||||
ps.print("]");
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
|
|
||||||
if (bit.name.startsWith("unused")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
psDatalog.print("entry = ");
|
|
||||||
psDatalog.print(name);
|
|
||||||
psDatalog.print(", \"");
|
|
||||||
writeDatalogName(psDatalog, name, bit.comment);
|
|
||||||
psDatalog.print("\", int, \"%d\"");
|
|
||||||
|
|
||||||
psDatalog.println();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.EnumField;
|
import com.rusefi.newparse.parsing.EnumField;
|
||||||
import com.rusefi.newparse.parsing.FieldOptions;
|
import com.rusefi.newparse.parsing.FieldOptions;
|
||||||
import com.rusefi.newparse.parsing.Type;
|
import com.rusefi.newparse.parsing.Type;
|
||||||
|
@ -8,12 +8,12 @@ import com.rusefi.newparse.parsing.Type;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class EnumLayout extends Layout {
|
public class EnumLayout extends Layout {
|
||||||
private final String name;
|
public final String name;
|
||||||
private final Type type;
|
public final Type type;
|
||||||
private final String enumType;
|
public final String enumType;
|
||||||
private final int endBit;
|
public final int endBit;
|
||||||
private final String[] values;
|
public final String[] values;
|
||||||
private final FieldOptions options;
|
public final FieldOptions options;
|
||||||
|
|
||||||
public EnumLayout(EnumField field) {
|
public EnumLayout(EnumField field) {
|
||||||
this.name = field.name;
|
this.name = field.name;
|
||||||
|
@ -29,66 +29,8 @@ public class EnumLayout extends Layout {
|
||||||
return this.type.size;
|
return this.type.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeEnumVal(PrintStream ps, String enumVal) {
|
|
||||||
ps.print('"');
|
|
||||||
ps.print(enumVal);
|
|
||||||
ps.print('"');
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
String name = prefixer.get(this.name);
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
ps.print(name);
|
|
||||||
ps.print(" = bits, ");
|
|
||||||
ps.print(this.type.tsType);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.offset + offsetAdd);
|
|
||||||
ps.print(", ");
|
|
||||||
|
|
||||||
ps.print("[0:");
|
|
||||||
ps.print(this.endBit);
|
|
||||||
ps.print("], ");
|
|
||||||
|
|
||||||
writeEnumVal(ps, this.values[0]);
|
|
||||||
|
|
||||||
for (int i = 1; i < this.values.length; i++) {
|
|
||||||
ps.print(", ");
|
|
||||||
writeEnumVal(ps, this.values[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
|
|
||||||
meta.addComment(name, this.options.comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, this.options.comment, this.options.units);
|
|
||||||
ps.println("\t" + this.enumType + " " + this.name + ";");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps, int[] arrayLength) {
|
|
||||||
this.writeCOffsetHeader(ps, this.options.comment, this.options.units);
|
|
||||||
ps.println("\t" + this.enumType + " " + this.name + "[" + arrayLength[0] + "];");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
// Output an enum as a scalar, since there's no TS support for enum output channels
|
|
||||||
ps.print(prefixer.get(name));
|
|
||||||
ps.print(" = scalar, ");
|
|
||||||
ps.print(this.type.tsType);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.offset + offsetAdd);
|
|
||||||
ps.println(", \"\", 1, 0");
|
|
||||||
|
|
||||||
// Write the datalog entry as an integer, since there's no support for enums.
|
|
||||||
psDatalog.print("entry = ");
|
|
||||||
psDatalog.print(name);
|
|
||||||
psDatalog.print(", \"");
|
|
||||||
writeDatalogName(psDatalog, name, options.comment);
|
|
||||||
psDatalog.print("\", int, \"%d\"");
|
|
||||||
psDatalog.println();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
@ -27,17 +27,7 @@ public abstract class Layout {
|
||||||
return "offset = " + offset + " size = " + this.getSize();
|
return "offset = " + offset + " size = " + this.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void writeTunerstudioLayout(PrintStream ps, TsMetadata meta) {
|
public void writeCOffsetHeader(PrintStream ps, String comment, String units) {
|
||||||
writeTunerstudioLayout(ps, meta, new StructNamePrefixer('_'), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {}
|
|
||||||
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd, int[] arrayLength) {
|
|
||||||
throw new IllegalStateException("This type can't be in an array!");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void writeCOffsetHeader(PrintStream ps, String comment, String units) {
|
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
comment = comment.replaceAll("[+]", "");
|
comment = comment.replaceAll("[+]", "");
|
||||||
comment = comment.replaceAll("\\n", "\n\t// ");
|
comment = comment.replaceAll("\\n", "\n\t// ");
|
||||||
|
@ -59,55 +49,14 @@ public abstract class Layout {
|
||||||
ps.println("\t// offset " + this.offsetWithinStruct);
|
ps.println("\t// offset " + this.offsetWithinStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeCLayout(PrintStream ps) { }
|
|
||||||
|
|
||||||
public void writeCLayout(PrintStream ps, int[] arrayLength) {
|
|
||||||
throw new IllegalStateException("This type can't be in an array!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) { }
|
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) { }
|
||||||
|
|
||||||
public void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, String prefix, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims)
|
||||||
StructNamePrefixer prefixer = new StructNamePrefixer('_');
|
{
|
||||||
|
throw new IllegalStateException("This type is missing its visitor");
|
||||||
if (prefix != null) {
|
|
||||||
prefixer.push(prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeOutputChannelLayout(ps, psDatalog, prefixer, offsetAdd);
|
public void visit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
}
|
doVisit(v, ps, prefixer, offsetAdd, arrayDims);
|
||||||
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) { }
|
|
||||||
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd, int[] arrayLength) {
|
|
||||||
throw new IllegalStateException("This type can't be in an array!");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void writeDatalogName(PrintStream ps, String name, String comment) {
|
|
||||||
String text = (comment == null || comment.isEmpty()) ? name : comment;
|
|
||||||
|
|
||||||
// Delete anything after a newline
|
|
||||||
text = text.split("\\\\n")[0];
|
|
||||||
|
|
||||||
ps.print(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeSdLogLayout(PrintStream ps, String sourceName) {
|
|
||||||
// TODO
|
|
||||||
final String prefix = null;
|
|
||||||
|
|
||||||
StructNamePrefixer prefixer = new StructNamePrefixer('.');
|
|
||||||
|
|
||||||
if (prefix != null) {
|
|
||||||
prefixer.push(prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeSdLogLayout(ps, prefixer, sourceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName) { }
|
|
||||||
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName, int[] arrayLength) {
|
|
||||||
throw new IllegalStateException("This type can't be in an array!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.ConfigDefinition;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
|
||||||
import com.rusefi.newparse.parsing.FieldOptions;
|
import com.rusefi.newparse.parsing.FieldOptions;
|
||||||
import com.rusefi.newparse.parsing.ScalarField;
|
import com.rusefi.newparse.parsing.ScalarField;
|
||||||
import com.rusefi.newparse.parsing.Type;
|
import com.rusefi.newparse.parsing.Type;
|
||||||
|
@ -10,9 +9,9 @@ import java.io.PrintStream;
|
||||||
|
|
||||||
public class ScalarLayout extends Layout {
|
public class ScalarLayout extends Layout {
|
||||||
public final String name;
|
public final String name;
|
||||||
private final Type type;
|
public final Type type;
|
||||||
private final FieldOptions options;
|
public final FieldOptions options;
|
||||||
private final boolean autoscale;
|
public final boolean autoscale;
|
||||||
|
|
||||||
public ScalarLayout(ScalarField field) {
|
public ScalarLayout(ScalarField field) {
|
||||||
this.name = field.name;
|
this.name = field.name;
|
||||||
|
@ -31,61 +30,7 @@ public class ScalarLayout extends Layout {
|
||||||
return "Scalar " + type.cType + " " + super.toString();
|
return "Scalar " + type.cType + " " + super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printBeforeArrayLength(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, String fieldType, int offsetAdd) {
|
public String makeScaleString() {
|
||||||
String name = prefixer.get(this.name);
|
|
||||||
ps.print(name);
|
|
||||||
ps.print(" = " + fieldType + ", ");
|
|
||||||
ps.print(this.type.tsType);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.offset + offsetAdd);
|
|
||||||
ps.print(", ");
|
|
||||||
|
|
||||||
meta.addComment(name, this.options.comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printAfterArrayLength(PrintStream ps) {
|
|
||||||
options.printTsFormat(ps);
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd, int[] arrayLength) {
|
|
||||||
if (arrayLength[0] == 0) {
|
|
||||||
// Skip zero length arrays, they may be used for dynamic padding but TS doesn't like them
|
|
||||||
return;
|
|
||||||
} else if (arrayLength[0] == 1) {
|
|
||||||
// For 1-length arrays, emit as a plain scalar instead
|
|
||||||
writeTunerstudioLayout(ps, meta, prefixer, offsetAdd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printBeforeArrayLength(ps, meta, prefixer, "array", offsetAdd);
|
|
||||||
|
|
||||||
ps.print("[");
|
|
||||||
ps.print(arrayLength[0]);
|
|
||||||
|
|
||||||
for (int i = 1; i < arrayLength.length; i++) {
|
|
||||||
if (arrayLength[i] == 1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.print('x');
|
|
||||||
ps.print(arrayLength[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.print("], ");
|
|
||||||
|
|
||||||
printAfterArrayLength(ps);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
printBeforeArrayLength(ps, meta, prefixer, "scalar", offsetAdd);
|
|
||||||
printAfterArrayLength(ps);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String makeScaleString() {
|
|
||||||
double scale = this.options.scale;
|
double scale = this.options.scale;
|
||||||
|
|
||||||
long mul, div;
|
long mul, div;
|
||||||
|
@ -107,47 +52,6 @@ public class ScalarLayout extends Layout {
|
||||||
return mul + ", " + div;
|
return mul + ", " + div;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, this.options.comment, this.options.units);
|
|
||||||
|
|
||||||
String cTypeName = this.type.cType.replaceAll("^int32_t$", "int");
|
|
||||||
|
|
||||||
if (this.autoscale) {
|
|
||||||
cTypeName = "scaled_channel<" + cTypeName + ", " + makeScaleString() + ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.print("\t" + cTypeName + " " + this.name);
|
|
||||||
|
|
||||||
if (ConfigDefinition.needZeroInit) {
|
|
||||||
ps.print(" = (" + this.type.cType.replaceAll("^int32_t$", "int") + ")0");
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.println(";");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps, int[] arrayLength) {
|
|
||||||
this.writeCOffsetHeader(ps, this.options.comment, this.options.units);
|
|
||||||
|
|
||||||
StringBuilder al = new StringBuilder();
|
|
||||||
|
|
||||||
al.append(arrayLength[0]);
|
|
||||||
|
|
||||||
for (int i = 1; i < arrayLength.length; i++) {
|
|
||||||
al.append("][");
|
|
||||||
al.append(arrayLength[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
String cTypeName = this.type.cType.replaceAll("^int32_t$", "int");
|
|
||||||
|
|
||||||
if (this.autoscale) {
|
|
||||||
cTypeName = "scaled_channel<" + cTypeName + ", " + makeScaleString() + ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.println("\t" + cTypeName + " " + this.name + "[" + al + "];");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
||||||
ps.print("static_assert(offsetof(");
|
ps.print("static_assert(offsetof(");
|
||||||
|
@ -159,109 +63,8 @@ public class ScalarLayout extends Layout {
|
||||||
ps.println(");");
|
ps.println(");");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd, int idx) {
|
|
||||||
String nameWithoutSpace = prefixer.get(idx > 0 ? (this.name + idx) : this.name);
|
|
||||||
String nameWithSpace = prefixer.get(idx > 0 ? (this.name + " " + idx) : this.name);
|
|
||||||
|
|
||||||
ps.print(nameWithoutSpace);
|
|
||||||
//ps.print(" = " + fieldType + ", ");
|
|
||||||
ps.print(" = scalar, ");
|
|
||||||
ps.print(this.type.tsType);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.offset + offsetAdd);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.options.units);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(FieldOptions.tryRound(this.options.scale));
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(FieldOptions.tryRound(this.options.offset));
|
|
||||||
ps.println();
|
|
||||||
|
|
||||||
if (this.name.startsWith("unused")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
psDatalog.print("entry = ");
|
|
||||||
psDatalog.print(nameWithoutSpace);
|
|
||||||
psDatalog.print(", \"");
|
|
||||||
|
|
||||||
String commentWithIndex = (idx <= 0 || options.comment.isEmpty()) ? options.comment : options.comment + " " + idx;
|
|
||||||
|
|
||||||
writeDatalogName(psDatalog, nameWithSpace, commentWithIndex);
|
|
||||||
psDatalog.print("\", ");
|
|
||||||
|
|
||||||
if (this.type.tsType.equals("F32") || this.options.scale != 1) {
|
|
||||||
psDatalog.print("float, \"%.3f\"");
|
|
||||||
} else {
|
|
||||||
psDatalog.print("int, \"%d\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
psDatalog.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
writeOutputChannelLayout(ps, psDatalog, prefixer, offsetAdd, -1);
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd, int[] arrayLength) {
|
|
||||||
if (arrayLength.length != 1) {
|
|
||||||
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
|
||||||
}
|
|
||||||
|
|
||||||
int elementOffset = offsetAdd;
|
|
||||||
|
|
||||||
for (int i = 0; i < arrayLength[0]; i++) {
|
|
||||||
writeOutputChannelLayout(ps, psDatalog, prefixer, elementOffset, i + 1);
|
|
||||||
elementOffset += type.size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName) {
|
|
||||||
writeSdLogLayout(ps, prefixer, "", "", sourceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName, int[] arrayLength) {
|
|
||||||
if (arrayLength.length != 1) {
|
|
||||||
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < arrayLength[0]; i++) {
|
|
||||||
writeSdLogLayout(ps, prefixer, "[" + i + "]", " " + (i + 1), sourceName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String arraySub, String commentSuffix, String sourceName) {
|
|
||||||
if (this.name.startsWith("unused")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// {engine->outputChannels.mafMeasured, "MAF", "kg/h", 1},
|
|
||||||
|
|
||||||
final String prefixedName = prefixer.get(this.name);
|
|
||||||
|
|
||||||
ps.print("\t{");
|
|
||||||
ps.print(sourceName);
|
|
||||||
ps.print(prefixedName);
|
|
||||||
ps.print(arraySub);
|
|
||||||
ps.print(", \"");
|
|
||||||
|
|
||||||
String comment = this.options.comment;
|
|
||||||
|
|
||||||
// default to name in case of no comment
|
|
||||||
if (comment == null || comment.length() == 0) {
|
|
||||||
comment = prefixedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.print(comment);
|
|
||||||
ps.print(commentSuffix);
|
|
||||||
ps.print("\", ");
|
|
||||||
ps.print(this.options.units);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(this.options.digits);
|
|
||||||
ps.println("},");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.StringField;
|
import com.rusefi.newparse.parsing.StringField;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class StringLayout extends Layout {
|
public class StringLayout extends Layout {
|
||||||
private final String name;
|
public final String name;
|
||||||
private final int size;
|
public final int size;
|
||||||
private final String comment;
|
public final String comment;
|
||||||
|
|
||||||
public StringLayout(StringField field) {
|
public StringLayout(StringField field) {
|
||||||
this.name = field.name;
|
this.name = field.name;
|
||||||
|
@ -32,34 +32,6 @@ public class StringLayout extends Layout {
|
||||||
return "String " + super.toString();
|
return "String " + super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
String name = prefixer.get(this.name);
|
|
||||||
ps.print(name);
|
|
||||||
ps.print(" = string, ASCII, ");
|
|
||||||
ps.print(this.offset + offsetAdd);
|
|
||||||
ps.print(", ");
|
|
||||||
ps.print(size);
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
|
|
||||||
if (!this.comment.isEmpty()) {
|
|
||||||
meta.addComment(name, comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, this.comment, null);
|
|
||||||
ps.println("\tchar " + this.name + "[" + this.size + "];");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps, int[] arrayLength) {
|
|
||||||
this.writeCOffsetHeader(ps, this.comment, null);
|
|
||||||
ps.println("\tchar " + this.name + "[" + arrayLength[0] + "][" + this.size + "];");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
public void writeCOffsetCheck(PrintStream ps, String parentTypeName) {
|
||||||
ps.print("static_assert(offsetof(");
|
ps.print("static_assert(offsetof(");
|
||||||
|
@ -70,4 +42,9 @@ public class StringLayout extends Layout {
|
||||||
ps.print(this.offsetWithinStruct);
|
ps.print(this.offsetWithinStruct);
|
||||||
ps.println(");");
|
ps.println(");");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.*;
|
import com.rusefi.newparse.parsing.*;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
@ -11,9 +11,9 @@ public class StructLayout extends Layout {
|
||||||
/*private*/public final List<Layout> children = new ArrayList<>();
|
/*private*/public final List<Layout> children = new ArrayList<>();
|
||||||
|
|
||||||
public final String typeName;
|
public final String typeName;
|
||||||
private final String name;
|
public final String name;
|
||||||
private final Boolean noPrefix;
|
public final Boolean noPrefix;
|
||||||
private final int size;
|
public final int size;
|
||||||
|
|
||||||
private static int getAlignedOffset(int offset, int alignment) {
|
private static int getAlignedOffset(int offset, int alignment) {
|
||||||
// Align each element to its own size
|
// Align each element to its own size
|
||||||
|
@ -155,104 +155,8 @@ public class StructLayout extends Layout {
|
||||||
return "Struct " + this.typeName + " " + super.toString();
|
return "Struct " + this.typeName + " " + super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
if (!this.noPrefix) {
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
prefixer.push(this.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// print all children in sequence
|
|
||||||
this.children.forEach(c -> c.writeTunerstudioLayout(ps, meta, prefixer, offsetAdd));
|
|
||||||
|
|
||||||
if (!this.noPrefix) {
|
|
||||||
prefixer.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, null, null);
|
|
||||||
ps.println("\t" + this.typeName + " " + this.name + ";");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps, int[] arrayLength) {
|
|
||||||
this.writeCOffsetHeader(ps, null, null);
|
|
||||||
ps.println("\t" + this.typeName + " " + this.name + "[" + arrayLength[0] + "];");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeCLayoutRoot(PrintStream ps) {
|
|
||||||
ps.println("struct " + this.typeName + " {");
|
|
||||||
|
|
||||||
this.children.forEach(c -> c.writeCLayout(ps));
|
|
||||||
|
|
||||||
ps.println("};");
|
|
||||||
ps.println("static_assert(sizeof(" + this.typeName + ") == " + getSize() + ");");
|
|
||||||
|
|
||||||
// Emit assertions to check that the offset of each child is correct according to the C++ compiler
|
|
||||||
this.children.forEach(c -> c.writeCOffsetCheck(ps, this.typeName));
|
|
||||||
|
|
||||||
ps.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd, String name) {
|
|
||||||
if (!this.noPrefix) {
|
|
||||||
prefixer.push(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.children.forEach(c -> c.writeOutputChannelLayout(ps, psDatalog, prefixer, offsetAdd));
|
|
||||||
|
|
||||||
if (!this.noPrefix) {
|
|
||||||
prefixer.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd) {
|
|
||||||
writeOutputChannelLayout(ps, psDatalog, prefixer, offsetAdd, this.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeOutputChannelLayout(PrintStream ps, PrintStream psDatalog, StructNamePrefixer prefixer, int offsetAdd, int[] arrayLength) {
|
|
||||||
if (arrayLength.length != 1) {
|
|
||||||
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
|
||||||
}
|
|
||||||
|
|
||||||
int elementOffset = offsetAdd;
|
|
||||||
|
|
||||||
for (int i = 0; i < arrayLength[0]; i++) {
|
|
||||||
writeOutputChannelLayout(ps, psDatalog, prefixer, elementOffset, this.name + (i + 1));
|
|
||||||
elementOffset += this.size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName, String name) {
|
|
||||||
if (!this.noPrefix) {
|
|
||||||
prefixer.push(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.children.forEach(c -> c.writeSdLogLayout(ps, prefixer, sourceName));
|
|
||||||
|
|
||||||
if (!this.noPrefix) {
|
|
||||||
prefixer.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName) {
|
|
||||||
writeSdLogLayout(ps, prefixer, sourceName, this.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeSdLogLayout(PrintStream ps, StructNamePrefixer prefixer, String sourceName, int[] arrayLength) {
|
|
||||||
if (arrayLength.length != 1) {
|
|
||||||
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: This doesn't quite work, as it's unclear how to make automatic naming work properly
|
|
||||||
// for (int i = 0; i < arrayLength[0]; i++) {
|
|
||||||
// writeSdLogLayout(ps, prefixer, sourceName, this.name + "[" + i + "]");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class StructNamePrefixer {
|
||||||
stack.push(name + this.prefixChar);
|
stack.push(name + this.prefixChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIndex(int idx) {
|
public void setIndex(int idx) {
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
this.idx = idx + 1;
|
this.idx = idx + 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,11 +34,11 @@ public class StructNamePrefixer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearIndex() {
|
public void clearIndex() {
|
||||||
this.idx = -1;
|
this.idx = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String get(String name) {
|
public String get(String name) {
|
||||||
if (name == null || name.isEmpty()) {
|
if (name == null || name.isEmpty()) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.ArrayField;
|
import com.rusefi.newparse.parsing.ArrayField;
|
||||||
import com.rusefi.newparse.parsing.Field;
|
import com.rusefi.newparse.parsing.Field;
|
||||||
import com.rusefi.newparse.parsing.ScalarField;
|
import com.rusefi.newparse.parsing.ScalarField;
|
||||||
|
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UnionLayout extends Layout {
|
public class UnionLayout extends Layout {
|
||||||
private final List<Layout> children = new ArrayList<>();
|
public final List<Layout> children = new ArrayList<>();
|
||||||
|
|
||||||
public UnionLayout(Union u) {
|
public UnionLayout(Union u) {
|
||||||
for (Field f : u.fields) {
|
for (Field f : u.fields) {
|
||||||
|
@ -56,18 +56,7 @@ public class UnionLayout extends Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
// Simply write out all children - no container necessary as fields can overlap in TS
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
this.children.forEach(c -> c.writeTunerstudioLayout(ps, meta, prefixer, offsetAdd));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, "union size " + this.getSize() + ", " + this.children.size() + " members", null);
|
|
||||||
|
|
||||||
// emit an anonymous union that contains all our members
|
|
||||||
ps.println("\tunion {");
|
|
||||||
this.children.forEach(c -> c.writeCLayout(ps));
|
|
||||||
ps.println("\t};");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.rusefi.newparse.layout;
|
package com.rusefi.newparse.layout;
|
||||||
|
|
||||||
import com.rusefi.newparse.outputs.TsMetadata;
|
import com.rusefi.newparse.outputs.ILayoutVisitor;
|
||||||
import com.rusefi.newparse.parsing.UnusedField;
|
import com.rusefi.newparse.parsing.UnusedField;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class UnusedLayout extends Layout {
|
public class UnusedLayout extends Layout {
|
||||||
private final int size;
|
public final int size;
|
||||||
|
|
||||||
public UnusedLayout(int size) {
|
public UnusedLayout(int size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
@ -32,13 +32,7 @@ public class UnusedLayout extends Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeTunerstudioLayout(PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, int offsetAdd) {
|
protected void doVisit(ILayoutVisitor v, PrintStream ps, StructNamePrefixer pfx, int offsetAdd, int[] arrayDims) {
|
||||||
ps.println("; unused " + this.size + " bytes at offset " + (this.offset + offsetAdd));
|
v.visit(this, ps, pfx, offsetAdd, arrayDims);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeCLayout(PrintStream ps) {
|
|
||||||
this.writeCOffsetHeader(ps, null, null);
|
|
||||||
ps.println("\tuint8_t alignmentFill_at_" + this.offsetWithinStruct + "[" + this.size + "];");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,12 @@ public class CStructWriter {
|
||||||
"#include \"rusefi_types.h\""
|
"#include \"rusefi_types.h\""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CStructsVisitor v = new CStructsVisitor();
|
||||||
|
|
||||||
for (Struct s : parser.getStructs()) {
|
for (Struct s : parser.getStructs()) {
|
||||||
StructLayout sl = new StructLayout(0, "root", s);
|
StructLayout sl = new StructLayout(0, "root", s);
|
||||||
sl.writeCLayoutRoot(ps);
|
|
||||||
|
v.visitRoot(sl, ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
ps.close();
|
ps.close();
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigDefinition;
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class CStructsVisitor extends ILayoutVisitor {
|
||||||
|
public void visitRoot(StructLayout sl, PrintStream ps) {
|
||||||
|
ps.println("struct " + sl.typeName + " {");
|
||||||
|
|
||||||
|
sl.children.forEach(c -> c.visit(this, ps, null, 0, new int[0]));
|
||||||
|
|
||||||
|
ps.println("};");
|
||||||
|
|
||||||
|
// Emit an assertion for the size of the whole thing
|
||||||
|
ps.println("static_assert(sizeof(" + sl.typeName + ") == " + sl.getSize() + ");");
|
||||||
|
|
||||||
|
// Emit assertions to check that the offset of each child is correct according to the C++ compiler
|
||||||
|
sl.children.forEach(c -> c.writeCOffsetCheck(ps, sl.typeName));
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(StructLayout sl, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
sl.writeCOffsetHeader(ps, null, null);
|
||||||
|
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
ps.println("\t" + sl.typeName + " " + sl.name + ";");
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
ps.println("\t" + sl.typeName + " " + sl.name + "[" + arrayDims[0] + "];");
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Multi dim array of structs not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
scalar.writeCOffsetHeader(ps, scalar.options.comment, scalar.options.units);
|
||||||
|
|
||||||
|
String cTypeName = scalar.type.cType.replaceAll("^int32_t$", "int");
|
||||||
|
|
||||||
|
if (scalar.autoscale) {
|
||||||
|
cTypeName = "scaled_channel<" + cTypeName + ", " + scalar.makeScaleString() + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.print("\t" + cTypeName + " " + scalar.name);
|
||||||
|
|
||||||
|
if (arrayDims.length > 0) {
|
||||||
|
StringBuilder al = new StringBuilder();
|
||||||
|
|
||||||
|
al.append('[');
|
||||||
|
al.append(arrayDims[0]);
|
||||||
|
|
||||||
|
for (int i = 1; i < arrayDims.length; i++) {
|
||||||
|
al.append("][");
|
||||||
|
al.append(arrayDims[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
al.append(']');
|
||||||
|
|
||||||
|
ps.print(al);
|
||||||
|
} else {
|
||||||
|
if (ConfigDefinition.needZeroInit) {
|
||||||
|
ps.print(" = (" + scalar.type.cType.replaceAll("^int32_t$", "int") + ")0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.println(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BitGroupLayout bg, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// always emit all 32 bits
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
if (i < bg.bits.size()) {
|
||||||
|
BitGroupLayout.BitLayout bit = bg.bits.get(i);
|
||||||
|
|
||||||
|
if (bit.comment != null) {
|
||||||
|
ps.println("\t// " + bit.comment.replaceAll("[+]", "").replaceAll(";", "").replace("\\n", "\n\t// "));
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.println("\t// offset " + bg.offsetWithinStruct + " bit " + i);
|
||||||
|
ps.println("\tbool " + bit.name + " : 1 {};");
|
||||||
|
} else {
|
||||||
|
// Force pad out all bit groups to a full 32b/4B
|
||||||
|
ps.println("\t// offset " + bg.offsetWithinStruct + " bit " + i);
|
||||||
|
ps.println("\tbool unusedBit_" + bg.offsetWithinStruct + "_" + i + " : 1 {};");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
e.writeCOffsetHeader(ps, e.options.comment, e.options.units);
|
||||||
|
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
ps.println("\t" + e.enumType + " " + e.name + ";");
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
ps.println("\t" + e.enumType + " " + e.name + "[" + arrayDims[0] + "];");
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Multi dim array of enums not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnusedLayout u, PrintStream ps, StructNamePrefixer prefixer, int offestAdd, int[] arrayDims) {
|
||||||
|
u.writeCOffsetHeader(ps, null, null);
|
||||||
|
ps.println("\tuint8_t alignmentFill_at_" + u.offsetWithinStruct + "[" + u.size + "];");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StringLayout str, PrintStream ps, StructNamePrefixer prefixer, int offestAdd, int[] arrayDims) {
|
||||||
|
str.writeCOffsetHeader(ps, str.comment, null);
|
||||||
|
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
ps.println("\tchar " + str.name + "[" + str.size + "];");
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
ps.println("\tchar " + str.name + "[" + arrayDims[0] + "][" + str.size + "];");
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Multi dim array of strings not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnionLayout u, PrintStream ps, StructNamePrefixer prefixer, int offestAdd, int[] arrayDims) {
|
||||||
|
u.writeCOffsetHeader(ps, "union size " + u.getSize() + ", " + u.children.size() + " members", null);
|
||||||
|
|
||||||
|
// emit an anonymous union that contains all our members
|
||||||
|
ps.println("\tunion {");
|
||||||
|
u.children.forEach(c -> c.visit(this, ps, prefixer, offestAdd, new int[0]));
|
||||||
|
ps.println("\t};");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ArrayLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Skip zero length arrays, they may be used for padding
|
||||||
|
if (arrayDims[0] > 0) {
|
||||||
|
super.visit(arr, ps, prefixer, offsetAdd, arrayDims);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class DatalogVisitor extends ILayoutVisitor {
|
||||||
|
private static void writeDatalogName(PrintStream ps, String name, String comment) {
|
||||||
|
String text = (comment == null || comment.isEmpty()) ? name : comment;
|
||||||
|
|
||||||
|
// Delete anything after a newline
|
||||||
|
text = text.split("\\\\n")[0];
|
||||||
|
|
||||||
|
ps.print(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visit(struct, ps, prefixer, offsetAdd, struct.name);
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
int elementOffset = offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visit(struct, ps, prefixer, elementOffset, struct.name + (i + 1));
|
||||||
|
elementOffset += struct.size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Output an enum as a scalar, since there's no TS support for enum output channels
|
||||||
|
// Write the datalog entry as an integer, since there's no support for enums.
|
||||||
|
ps.print("entry = ");
|
||||||
|
ps.print(e.name);
|
||||||
|
ps.print(", \"");
|
||||||
|
writeDatalogName(ps, e.name, e.options.comment);
|
||||||
|
ps.print("\", int, \"%d\"");
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int idx) {
|
||||||
|
if (scalar.name.startsWith("unused")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String nameWithoutSpace = prefixer.get(idx > 0 ? (scalar.name + idx) : scalar.name);
|
||||||
|
String nameWithSpace = prefixer.get(idx > 0 ? (scalar.name + " " + idx) : scalar.name);
|
||||||
|
|
||||||
|
ps.print("entry = ");
|
||||||
|
ps.print(nameWithoutSpace);
|
||||||
|
ps.print(", \"");
|
||||||
|
|
||||||
|
String commentWithIndex = (idx <= 0 || scalar.options.comment.isEmpty()) ? scalar.options.comment : scalar.options.comment + " " + idx;
|
||||||
|
|
||||||
|
writeDatalogName(ps, nameWithSpace, commentWithIndex);
|
||||||
|
ps.print("\", ");
|
||||||
|
|
||||||
|
if (scalar.type.tsType.equals("F32") || scalar.options.scale != 1) {
|
||||||
|
ps.print("float, \"%.3f\"");
|
||||||
|
} else {
|
||||||
|
ps.print("int, \"%d\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visit(scalar, ps, prefixer, offsetAdd, -1);
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
int elementOffset = offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visit(scalar, ps, prefixer, elementOffset, i + 1);
|
||||||
|
elementOffset += scalar.type.size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BitGroupLayout b, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
int actualOffset = b.offset + offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < b.bits.size(); i++) {
|
||||||
|
BitGroupLayout.BitLayout bit = b.bits.get(i);
|
||||||
|
|
||||||
|
if (bit.name.startsWith("unused")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String name = prefixer.get(bit.name);
|
||||||
|
|
||||||
|
ps.print("entry = ");
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(", \"");
|
||||||
|
writeDatalogName(ps, name, bit.comment);
|
||||||
|
ps.print("\", int, \"%d\"");
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnionLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnusedLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public abstract class ILayoutVisitor {
|
||||||
|
protected void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, String name) {
|
||||||
|
if (!struct.noPrefix) {
|
||||||
|
prefixer.push(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct.children.forEach(c -> c.visit(this, ps, prefixer, offsetAdd, new int[0]));
|
||||||
|
|
||||||
|
if (!struct.noPrefix) {
|
||||||
|
prefixer.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("StructLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("EnumLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(StringLayout str, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("StringLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("ScalarLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(BitGroupLayout bitGroup, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("BitGroupLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(UnionLayout union, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("UnionLayout not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(UnusedLayout unused, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// throw new IllegalStateException("UnusedLayout not supported");
|
||||||
|
// I guess we allow unusedlayout, it is unused, after all
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(ArrayLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
arr.prototypeLayout.visit(this, ps, prefixer, offsetAdd, arr.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(ArrayIterateStructLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Default to use normal array behavior, a visitor can override if desired
|
||||||
|
visit((ArrayLayout) arr, ps, prefixer, offsetAdd, arrayDims);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(ArrayIterateScalarLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Default to use normal array behavior, a visitor can override if desired
|
||||||
|
visit((ArrayLayout) arr, ps, prefixer, offsetAdd, arrayDims);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.ParseState;
|
||||||
|
import com.rusefi.newparse.layout.StructLayout;
|
||||||
|
import com.rusefi.newparse.parsing.Struct;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class JavaFieldsWriter {
|
||||||
|
private final PrintStream ps;
|
||||||
|
|
||||||
|
public JavaFieldsWriter(String outputFile, String javaConstants) throws FileNotFoundException {
|
||||||
|
this.ps = new PrintStreamAlwaysUnix(new FileOutputStream(outputFile));
|
||||||
|
|
||||||
|
ps.println(javaConstants);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeJavaFields(ParseState parser) {
|
||||||
|
Struct s = parser.getStructs().get(parser.getStructs().size() - 1);
|
||||||
|
|
||||||
|
StructLayout sl = new StructLayout(0, "root", s);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
import com.rusefi.newparse.parsing.FieldOptions;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class OutputChannelVisitor extends ILayoutVisitor {
|
||||||
|
@Override
|
||||||
|
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visit(struct, ps, prefixer, offsetAdd, struct.name);
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
int elementOffset = offsetAdd + struct.offset;
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visit(struct, ps, prefixer, elementOffset, struct.name + (i + 1));
|
||||||
|
elementOffset += struct.size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Output an enum as a scalar, since there's no TS support for enum output channels
|
||||||
|
ps.print(prefixer.get(e.name));
|
||||||
|
ps.print(" = scalar, ");
|
||||||
|
ps.print(e.type.tsType);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(e.offset + offsetAdd);
|
||||||
|
ps.println(", \"\", 1, 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StringLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("String layout not supported for output channels");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int idx) {
|
||||||
|
String nameWithoutSpace = prefixer.get(idx > 0 ? (scalar.name + idx) : scalar.name);
|
||||||
|
String nameWithSpace = prefixer.get(idx > 0 ? (scalar.name + " " + idx) : scalar.name);
|
||||||
|
|
||||||
|
ps.print(nameWithoutSpace);
|
||||||
|
//ps.print(" = " + fieldType + ", ");
|
||||||
|
ps.print(" = scalar, ");
|
||||||
|
ps.print(scalar.type.tsType);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(scalar.offset + offsetAdd);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(scalar.options.units);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(FieldOptions.tryRound(scalar.options.scale));
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(FieldOptions.tryRound(scalar.options.offset));
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visit(scalar, ps, prefixer, offsetAdd, -1);
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
int elementOffset = offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visit(scalar, ps, prefixer, elementOffset, i + 1);
|
||||||
|
elementOffset += scalar.type.size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BitGroupLayout b, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
int actualOffset = b.offset + offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < b.bits.size(); i++) {
|
||||||
|
BitGroupLayout.BitLayout bit = b.bits.get(i);
|
||||||
|
|
||||||
|
String name = prefixer.get(bit.name);
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(" = bits, U32, ");
|
||||||
|
ps.print(actualOffset);
|
||||||
|
ps.print(", [");
|
||||||
|
ps.print(i + ":" + i);
|
||||||
|
|
||||||
|
ps.print("]");
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnionLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
throw new IllegalStateException("Output channels don't support unions");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnusedLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
import com.rusefi.newparse.ParseState;
|
import com.rusefi.newparse.ParseState;
|
||||||
import com.rusefi.newparse.layout.StructLayout;
|
import com.rusefi.newparse.layout.StructLayout;
|
||||||
|
import com.rusefi.newparse.layout.StructNamePrefixer;
|
||||||
import com.rusefi.newparse.parsing.Struct;
|
import com.rusefi.newparse.parsing.Struct;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
@ -32,7 +33,18 @@ public class OutputChannelWriter {
|
||||||
Struct s = parser.getStructs().get(parser.getStructs().size() - 1);
|
Struct s = parser.getStructs().get(parser.getStructs().size() - 1);
|
||||||
|
|
||||||
StructLayout sl = new StructLayout(0, "root", s);
|
StructLayout sl = new StructLayout(0, "root", s);
|
||||||
sl.writeOutputChannelLayout(ps, psDatalog, namePrefix, cumulativeSize);
|
|
||||||
|
StructNamePrefixer prefixer = new StructNamePrefixer('_');
|
||||||
|
|
||||||
|
if (namePrefix != null) {
|
||||||
|
prefixer.push(namePrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputChannelVisitor v = new OutputChannelVisitor();
|
||||||
|
sl.visit(v, ps, prefixer, cumulativeSize, new int[0]);
|
||||||
|
|
||||||
|
DatalogVisitor dlv = new DatalogVisitor();
|
||||||
|
sl.visit(dlv, psDatalog, prefixer, cumulativeSize, new int[0]);
|
||||||
|
|
||||||
cumulativeSize += sl.getSize();
|
cumulativeSize += sl.getSize();
|
||||||
ps.println("; total TS size = " + cumulativeSize);
|
ps.println("; total TS size = " + cumulativeSize);
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class SdLogVisitor extends ILayoutVisitor {
|
||||||
|
private final String mSourceName;
|
||||||
|
|
||||||
|
public SdLogVisitor(String sourceName) {
|
||||||
|
mSourceName = sourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visit(struct, ps, prefixer, offsetAdd, struct.name);
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
int elementOffset = offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visit(struct, ps, prefixer, elementOffset, struct.name + "[" + i + "]");
|
||||||
|
elementOffset += struct.size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visitScalar(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, String arraySub, String commentSuffix) {
|
||||||
|
final String prefixedName = prefixer.get(scalar.name);
|
||||||
|
|
||||||
|
ps.print("\t{");
|
||||||
|
ps.print(mSourceName);
|
||||||
|
ps.print(prefixedName);
|
||||||
|
ps.print(arraySub);
|
||||||
|
ps.print(", \"");
|
||||||
|
|
||||||
|
String comment = scalar.options.comment;
|
||||||
|
|
||||||
|
// default to name in case of no comment
|
||||||
|
if (comment == null || comment.isEmpty()) {
|
||||||
|
comment = prefixedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.print(comment.split("\\n")[0]);
|
||||||
|
ps.print(commentSuffix);
|
||||||
|
ps.print("\", ");
|
||||||
|
ps.print(scalar.options.units);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(scalar.options.digits);
|
||||||
|
ps.println("},");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (scalar.name.startsWith("unused")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
visitScalar(scalar, ps, prefixer, "", "");
|
||||||
|
} else if (arrayDims.length == 1) {
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
visitScalar(scalar, ps, prefixer, "[" + i + "]", " " + (i + 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("SD log doesn't support multi dimension arrays");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BitGroupLayout bitGroup, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
import com.rusefi.newparse.ParseState;
|
import com.rusefi.newparse.ParseState;
|
||||||
import com.rusefi.newparse.layout.StructLayout;
|
import com.rusefi.newparse.layout.StructLayout;
|
||||||
|
import com.rusefi.newparse.layout.StructNamePrefixer;
|
||||||
import com.rusefi.newparse.parsing.Struct;
|
import com.rusefi.newparse.parsing.Struct;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
@ -31,6 +32,10 @@ public class SdLogWriter {
|
||||||
Struct s = parser.getStructs().get(parser.getStructs().size() - 1);
|
Struct s = parser.getStructs().get(parser.getStructs().size() - 1);
|
||||||
|
|
||||||
StructLayout sl = new StructLayout(0, "root", s);
|
StructLayout sl = new StructLayout(0, "root", s);
|
||||||
sl.writeSdLogLayout(ps, sourceName);
|
|
||||||
|
SdLogVisitor v = new SdLogVisitor(sourceName);
|
||||||
|
StructNamePrefixer prefixer = new StructNamePrefixer('.');
|
||||||
|
|
||||||
|
v.visit(sl, ps, prefixer, 0, new int[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,182 @@
|
||||||
|
package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
|
import com.rusefi.newparse.layout.*;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class TsLayoutVisitor extends ILayoutVisitor {
|
||||||
|
private final TsMetadata meta;
|
||||||
|
|
||||||
|
public TsLayoutVisitor(TsMetadata meta) {
|
||||||
|
this.meta = meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length != 0) {
|
||||||
|
throw new IllegalStateException("TS layout struct array not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
visit(struct, ps, prefixer, offsetAdd, struct.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeEnumVal(PrintStream ps, String enumVal) {
|
||||||
|
ps.print('"');
|
||||||
|
ps.print(enumVal);
|
||||||
|
ps.print('"');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
String name = prefixer.get(e.name);
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(" = bits, ");
|
||||||
|
ps.print(e.type.tsType);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(e.offset + offsetAdd);
|
||||||
|
ps.print(", ");
|
||||||
|
|
||||||
|
ps.print("[0:");
|
||||||
|
ps.print(e.endBit);
|
||||||
|
ps.print("], ");
|
||||||
|
|
||||||
|
writeEnumVal(ps, e.values[0]);
|
||||||
|
|
||||||
|
for (int i = 1; i < e.values.length; i++) {
|
||||||
|
ps.print(", ");
|
||||||
|
writeEnumVal(ps, e.values[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
|
||||||
|
meta.addComment(name, e.options.comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(StringLayout str, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
String name = prefixer.get(str.name);
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(" = string, ASCII, ");
|
||||||
|
ps.print(str.offset + offsetAdd);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(str.size);
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
|
||||||
|
if (!str.comment.isEmpty()) {
|
||||||
|
meta.addComment(name, str.comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printBeforeArrayLength(ScalarLayout scalar, PrintStream ps, TsMetadata meta, StructNamePrefixer prefixer, String fieldType, int offsetAdd) {
|
||||||
|
String name = prefixer.get(scalar.name);
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(" = " + fieldType + ", ");
|
||||||
|
ps.print(scalar.type.tsType);
|
||||||
|
ps.print(", ");
|
||||||
|
ps.print(scalar.offset + offsetAdd);
|
||||||
|
ps.print(", ");
|
||||||
|
|
||||||
|
meta.addComment(name, scalar.options.comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printAfterArrayLength(ScalarLayout scalar, PrintStream ps) {
|
||||||
|
scalar.options.printTsFormat(ps);
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ScalarLayout scalar, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
if (arrayDims.length == 0) {
|
||||||
|
// plain scalar, not array
|
||||||
|
printBeforeArrayLength(scalar, ps, meta, prefixer, "scalar", offsetAdd);
|
||||||
|
printAfterArrayLength(scalar, ps);
|
||||||
|
} else {
|
||||||
|
if (arrayDims[0] == 0) {
|
||||||
|
// Skip zero length arrays, they may be used for dynamic padding but TS doesn't like them
|
||||||
|
return;
|
||||||
|
} else if (arrayDims[0] == 1) {
|
||||||
|
// For 1-length arrays, emit as a plain scalar instead
|
||||||
|
visit(scalar, ps, prefixer, offsetAdd, new int[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printBeforeArrayLength(scalar, ps, meta, prefixer, "array", offsetAdd);
|
||||||
|
ps.print("[");
|
||||||
|
ps.print(arrayDims[0]);
|
||||||
|
|
||||||
|
for (int i = 1; i < arrayDims.length; i++) {
|
||||||
|
if (arrayDims[i] == 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.print('x');
|
||||||
|
ps.print(arrayDims[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.print("], ");
|
||||||
|
|
||||||
|
printAfterArrayLength(scalar, ps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BitGroupLayout b, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
int actualOffset = b.offset + offsetAdd;
|
||||||
|
|
||||||
|
for (int i = 0; i < b.bits.size(); i++) {
|
||||||
|
BitGroupLayout.BitLayout bit = b.bits.get(i);
|
||||||
|
|
||||||
|
String name = prefixer.get(bit.name);
|
||||||
|
|
||||||
|
ps.print(name);
|
||||||
|
ps.print(" = bits, U32, ");
|
||||||
|
ps.print(actualOffset);
|
||||||
|
ps.print(", [");
|
||||||
|
ps.print(i + ":" + i);
|
||||||
|
|
||||||
|
ps.print("], " + bit.falseValue + ", " + bit.trueValue);
|
||||||
|
|
||||||
|
ps.println();
|
||||||
|
|
||||||
|
meta.addComment(name, bit.comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnionLayout u, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
u.children.forEach(c -> c.visit(this, ps, prefixer, offsetAdd, new int[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(UnusedLayout u, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
ps.println("; unused " + u.size + " bytes at offset " + (u.offset + offsetAdd));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ArrayIterateScalarLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
offsetAdd += arr.offset;
|
||||||
|
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
// Set element's position within the array
|
||||||
|
arr.prototypeLayout.setOffset(offsetAdd + arr.prototypeLayout.getSize() * i);
|
||||||
|
|
||||||
|
// Put a 1-based index on the end of the name to distinguish in TS
|
||||||
|
prefixer.setIndex(i);
|
||||||
|
arr.prototypeLayout.visit(this, ps, prefixer, 0, new int[0]);
|
||||||
|
prefixer.clearIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ArrayIterateStructLayout arr, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||||
|
for (int i = 0; i < arrayDims[0]; i++) {
|
||||||
|
// Put a 1-based index on the end of the name to distinguish in TS
|
||||||
|
prefixer.setIndex(i);
|
||||||
|
arr.prototypeLayout.visit(this, ps, prefixer, arr.offset + offsetAdd + arr.prototypeLayout.getSize() * i, new int[0]);
|
||||||
|
prefixer.clearIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.rusefi.newparse.outputs;
|
||||||
|
|
||||||
import com.rusefi.newparse.ParseState;
|
import com.rusefi.newparse.ParseState;
|
||||||
import com.rusefi.newparse.layout.StructLayout;
|
import com.rusefi.newparse.layout.StructLayout;
|
||||||
|
import com.rusefi.newparse.layout.StructNamePrefixer;
|
||||||
import com.rusefi.newparse.parsing.Definition;
|
import com.rusefi.newparse.parsing.Definition;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -95,7 +96,12 @@ public class TsWriter {
|
||||||
int size = root.getSize();
|
int size = root.getSize();
|
||||||
ps.println("pageSize = " + size);
|
ps.println("pageSize = " + size);
|
||||||
ps.println("page = 1");
|
ps.println("page = 1");
|
||||||
root.writeTunerstudioLayout(ps, meta);
|
|
||||||
|
StructNamePrefixer prefixer = new StructNamePrefixer('_');
|
||||||
|
|
||||||
|
TsLayoutVisitor v = new TsLayoutVisitor(meta);
|
||||||
|
root.visit(v, ps, prefixer, 0, new int[0]);
|
||||||
|
|
||||||
ps.println("; total TS size = " + size);
|
ps.println("; total TS size = " + size);
|
||||||
|
|
||||||
// Print context help
|
// Print context help
|
||||||
|
|
|
@ -232,32 +232,53 @@ public class LayoutTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void arrayOfStructsIterate() throws IOException {
|
public void arrayOfStructsIterate() throws IOException {
|
||||||
String ts = parseToTs(
|
String input =
|
||||||
"struct s1\n" +
|
"struct s1\n" +
|
||||||
"uint8_t var1\n" +
|
"uint8_t var1\n" +
|
||||||
"uint16_t var2\n" +
|
"uint16_t var2\n" +
|
||||||
"end_struct\n" +
|
"end_struct\n" +
|
||||||
"struct_no_prefix rootStruct\n" +
|
"struct_no_prefix rootStruct\n" +
|
||||||
|
"int spacer\n" +
|
||||||
|
"s1 non_arr\n" +
|
||||||
"s1[4 iterate] arr\n" +
|
"s1[4 iterate] arr\n" +
|
||||||
"end_struct");
|
"end_struct";
|
||||||
|
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"pageSize = 16\n" +
|
"pageSize = 24\n" +
|
||||||
"page = 1\n" +
|
"page = 1\n" +
|
||||||
"arr1_var1 = scalar, U08, 0, \"\", 1, 0, 0, 0, 0\n" +
|
"spacer = scalar, S32, 0, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"; unused 1 bytes at offset 1\n" +
|
"non_arr_var1 = scalar, U08, 4, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"arr1_var2 = scalar, U16, 2, \"\", 1, 0, 0, 0, 0\n" +
|
|
||||||
"arr2_var1 = scalar, U08, 4, \"\", 1, 0, 0, 0, 0\n" +
|
|
||||||
"; unused 1 bytes at offset 5\n" +
|
"; unused 1 bytes at offset 5\n" +
|
||||||
"arr2_var2 = scalar, U16, 6, \"\", 1, 0, 0, 0, 0\n" +
|
"non_arr_var2 = scalar, U16, 6, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"arr3_var1 = scalar, U08, 8, \"\", 1, 0, 0, 0, 0\n" +
|
"arr1_var1 = scalar, U08, 8, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"; unused 1 bytes at offset 9\n" +
|
"; unused 1 bytes at offset 9\n" +
|
||||||
"arr3_var2 = scalar, U16, 10, \"\", 1, 0, 0, 0, 0\n" +
|
"arr1_var2 = scalar, U16, 10, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"arr4_var1 = scalar, U08, 12, \"\", 1, 0, 0, 0, 0\n" +
|
"arr2_var1 = scalar, U08, 12, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"; unused 1 bytes at offset 13\n" +
|
"; unused 1 bytes at offset 13\n" +
|
||||||
"arr4_var2 = scalar, U16, 14, \"\", 1, 0, 0, 0, 0\n" +
|
"arr2_var2 = scalar, U16, 14, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"; total TS size = 16\n" +
|
"arr3_var1 = scalar, U08, 16, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
"[SettingContextHelp]\n", ts);
|
"; unused 1 bytes at offset 17\n" +
|
||||||
|
"arr3_var2 = scalar, U16, 18, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
|
"arr4_var1 = scalar, U08, 20, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
|
"; unused 1 bytes at offset 21\n" +
|
||||||
|
"arr4_var2 = scalar, U16, 22, \"\", 1, 0, 0, 0, 0\n" +
|
||||||
|
"; total TS size = 24\n" +
|
||||||
|
"[SettingContextHelp]\n", parseToTs(input));
|
||||||
|
|
||||||
|
Assert.assertEquals(
|
||||||
|
"spacer = scalar, S32, 0, \"\", 1, 0\n" +
|
||||||
|
"non_arr_var1 = scalar, U08, 4, \"\", 1, 0\n" +
|
||||||
|
"non_arr_var2 = scalar, U16, 6, \"\", 1, 0\n" +
|
||||||
|
"arr1_var1 = scalar, U08, 8, \"\", 1, 0\n" +
|
||||||
|
"arr1_var2 = scalar, U16, 10, \"\", 1, 0\n" +
|
||||||
|
"arr2_var1 = scalar, U08, 12, \"\", 1, 0\n" +
|
||||||
|
"arr2_var2 = scalar, U16, 14, \"\", 1, 0\n" +
|
||||||
|
"arr3_var1 = scalar, U08, 16, \"\", 1, 0\n" +
|
||||||
|
"arr3_var2 = scalar, U16, 18, \"\", 1, 0\n" +
|
||||||
|
"arr4_var1 = scalar, U08, 20, \"\", 1, 0\n" +
|
||||||
|
"arr4_var2 = scalar, U16, 22, \"\", 1, 0\n" +
|
||||||
|
"; total TS size = 24\n",
|
||||||
|
parseToOutputChannels(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
// IEtbController mocks
|
// IEtbController mocks
|
||||||
MOCK_METHOD(void, reset, (), (override));
|
MOCK_METHOD(void, reset, (), (override));
|
||||||
MOCK_METHOD(bool, isEtbMode, (), (override));
|
MOCK_METHOD(bool, isEtbMode, (), (const, override));
|
||||||
MOCK_METHOD(void, update, (), (override));
|
MOCK_METHOD(void, update, (), (override));
|
||||||
MOCK_METHOD(bool, init, (dc_function_e function, DcMotor* motor, pid_s* pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles), (override));
|
MOCK_METHOD(bool, init, (dc_function_e function, DcMotor* motor, pid_s* pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles), (override));
|
||||||
MOCK_METHOD(void, setIdlePosition, (percent_t pos), (override));
|
MOCK_METHOD(void, setIdlePosition, (percent_t pos), (override));
|
||||||
|
|
|
@ -61,7 +61,7 @@ TEST(etb, initializationSingleThrottle) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
EXPECT_CALL(mocks[0], isEtbMode())
|
EXPECT_CALL(mocks[0], isEtbMode())
|
||||||
.WillOnce(Return(TRUE));
|
.WillOnce(Return(true));
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* cfg) {
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* cfg) {
|
||||||
engineConfiguration->etbFunctions[0] = DC_Throttle1;
|
engineConfiguration->etbFunctions[0] = DC_Throttle1;
|
||||||
|
@ -89,7 +89,7 @@ TEST(etb, initializationSingleThrottleInSecondSlot) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
EXPECT_CALL(mocks[1], isEtbMode())
|
EXPECT_CALL(mocks[1], isEtbMode())
|
||||||
.WillOnce(Return(TRUE));
|
.WillOnce(Return(true));
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* cfg) {
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE, [](engine_configuration_s* cfg) {
|
||||||
engineConfiguration->etbFunctions[0] = DC_None;
|
engineConfiguration->etbFunctions[0] = DC_None;
|
||||||
|
@ -117,9 +117,9 @@ TEST(etb, initializationDualThrottle) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
EXPECT_CALL(mocks[0], isEtbMode())
|
EXPECT_CALL(mocks[0], isEtbMode())
|
||||||
.WillOnce(Return(TRUE));
|
.WillOnce(Return(true));
|
||||||
EXPECT_CALL(mocks[1], isEtbMode())
|
EXPECT_CALL(mocks[1], isEtbMode())
|
||||||
.WillOnce(Return(TRUE));
|
.WillOnce(Return(true));
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
|
||||||
|
@ -339,18 +339,19 @@ TEST(etb, setpointSecondThrottleTrim) {
|
||||||
return y;
|
return y;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Should get called with the un-adjusted setpoint
|
struct MockEtb2 : EtbController2 {
|
||||||
StrictMock<MockVp3d> throttleTrimTable;
|
MOCK_METHOD(percent_t, getThrottleTrim, (float rpm, percent_t targetPosition), (const, override));
|
||||||
EXPECT_CALL(throttleTrimTable, getValue(0, 47))
|
};
|
||||||
.WillOnce(Return(4));
|
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
||||||
Sensor::setMockValue(SensorType::Tps1, 0.0f, true);
|
Sensor::setMockValue(SensorType::Tps1, 0.0f, true);
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController2 etb(throttleTrimTable);
|
StrictMock<MockEtb2> etb;
|
||||||
etb.init(DC_Throttle1, nullptr, nullptr, &pedalMap, true);
|
etb.init(DC_Throttle1, nullptr, nullptr, &pedalMap, true);
|
||||||
|
// Should get called with the un-adjusted setpoint
|
||||||
|
EXPECT_CALL(etb, getThrottleTrim(0, 47)).WillOnce(Return(4));
|
||||||
|
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 47, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 47, true);
|
||||||
EXPECT_EQ(51, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(51, etb.getSetpoint().value_or(-1));
|
||||||
|
|
Loading…
Reference in New Issue