NB2 progress, ETB Live Docs progress

This commit is contained in:
rusEfi 2019-09-01 19:37:58 -04:00
parent b8fa0dec72
commit 8126b700de
13 changed files with 70 additions and 25 deletions

View File

@ -509,7 +509,7 @@ void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGN
*/
void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etb.pFactor = 22;
engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE?
engineConfiguration->etb.iFactor = 0;
engineConfiguration->etb.dFactor = 0;
engineConfiguration->etb.offset = 0;
@ -523,7 +523,7 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
// set tps_min 90
engineConfiguration->tpsMin = 870;
engineConfiguration->tpsMin = 90;
// set tps_max 540
engineConfiguration->tpsMax = 870;

View File

@ -270,11 +270,16 @@ DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
DISPLAY_TEXT(eol);
DISPLAY_STATE(ETB_pid)
DISPLAY_TEXT(input);
DISPLAY(DISPLAY_FIELD(input));
DISPLAY_TEXT(Output);
DISPLAY(DISPLAY_FIELD(output));
DISPLAY_TEXT(iTerm);
DISPLAY(DISPLAY_FIELD(iTerm));
DISPLAY_TEXT(eol);
DISPLAY(DISPLAY_FIELD(errorAmplificationCoef));
DISPLAY(DISPLAY_FIELD(previousError));
DISPLAY_TEXT(eol);
DISPLAY_TEXT(Settings);
DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR));
@ -283,6 +288,9 @@ DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
DISPLAY_TEXT(eol);
DISPLAY(DISPLAY_CONFIG(ETB_OFFSET));
DISPLAY(DISPLAY_CONFIG(ETB_PERIODMS));
DISPLAY_TEXT(eol);
DISPLAY(DISPLAY_CONFIG(ETB_MINVALUE));
DISPLAY(DISPLAY_CONFIG(ETB_MAXVALUE));
/* DISPLAY_ELSE */
DISPLAY_TEXT(No_Pedal_Sensor);
/* DISPLAY_ENDIF */
@ -409,10 +417,6 @@ void setBoschVNH2SP30Curve(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->etbBiasValues[5] = 20;
engineConfiguration->etbBiasValues[6] = 26;
engineConfiguration->etbBiasValues[7] = 28;
// values are above 100% since we have feedforward part of the total summation
engineConfiguration->etb.minValue = -200;
engineConfiguration->etb.maxValue = 200;
}
void setDefaultEtbParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -438,6 +442,10 @@ void setDefaultEtbParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->etbFreq = DEFAULT_ETB_PWM_FREQUENCY;
engineConfiguration->etb_iTermMin = -300;
engineConfiguration->etb_iTermMax = 300;
// values are above 100% since we have feedforward part of the total summation
engineConfiguration->etb.minValue = -200;
engineConfiguration->etb.maxValue = 200;
}
static bool isSamePins(etb_io *current, etb_io *active) {

View File

@ -628,9 +628,6 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->auxPid[0].minValue = 10;
engineConfiguration->auxPid[0].maxValue = 90;
engineConfiguration->etb.minValue = 0;
engineConfiguration->etb.maxValue = 99;
engineConfiguration->alternatorControl.minValue = 10;
engineConfiguration->alternatorControl.maxValue = 90;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 11:57:50 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 19:07:42 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_PID_STATE_GENERATED_H
@ -34,11 +34,15 @@ struct pid_state_s {
* offset 20
*/
float errorAmplificationCoef = (float)0;
/** total size 24*/
/**
* offset 24
*/
float previousError = (float)0;
/** total size 28*/
};
typedef struct pid_state_s pid_state_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 11:57:50 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 19:07:42 EDT 2019

View File

@ -5,6 +5,7 @@ struct_no_prefix pid_state_s
float input;only used for logging
float output;only used for logging
float errorAmplificationCoef;
float previousError
end_struct

View File

@ -70,9 +70,6 @@ public:
private:
pid_s *parameters;
float previousError;
private:
virtual void updateITerm(float value);
};

View File

@ -35,6 +35,7 @@ import static com.rusefi.binaryprotocol.IoHelper.*;
public class BinaryProtocol implements BinaryProtocolCommands {
private static final String USE_PLAIN_PROTOCOL_PROPERTY = "protocol.plain";
private static final int TEXT_PULL_PERIOD = 100;
/**
* This properly allows to switch to non-CRC32 mode
* todo: finish this feature, assuming we even need it.
@ -69,9 +70,9 @@ public class BinaryProtocol implements BinaryProtocolCommands {
stream.setInputListener(incomingData::addData);
}
private static void sleep() {
private static void sleep(int millis) {
try {
Thread.sleep(100);
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
@ -146,7 +147,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
}
});
}
sleep();
sleep(TEXT_PULL_PERIOD);
}
FileLog.MAIN.logLine("Stopping text pull");
}

View File

@ -2,6 +2,9 @@ package com.rusefi.ui.livedocs;
import com.rusefi.binaryprotocol.BinaryProtocol;
/**
* (c) Andrey Belomutskiy 2013-2019
*/
public abstract class LiveDocHolder {
private final LiveDataContext id;
private final RefreshActionsMap actions;

View File

@ -14,6 +14,7 @@ import static com.rusefi.binaryprotocol.IoHelper.swap16;
/**
* Singleton map of all live documentation entities. Using this registry we know all the entities to update periodically.
* (c) Andrey Belomutskiy 2013-2019
*/
public enum LiveDocsRegistry {
INSTANCE;
@ -41,7 +42,7 @@ public enum LiveDocsRegistry {
Field[] values = StateDictionary.INSTANCE.getFields("refresh", context);
int size = Field.getStructureSize(values);
byte packet[] = new byte[5];
byte[] packet = new byte[5];
packet[0] = COMMAND_GET_STRUCT;
putShort(packet, 1, swap16(liveDocRequestId)); // offset
putShort(packet, 3, swap16(size));

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 11:57:50 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 19:07:42 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
@ -12,6 +12,7 @@ public class PidState {
public static final Field INPUT = Field.create("INPUT", 12, FieldType.FLOAT);
public static final Field OUTPUT = Field.create("OUTPUT", 16, FieldType.FLOAT);
public static final Field ERRORAMPLIFICATIONCOEF = Field.create("ERRORAMPLIFICATIONCOEF", 20, FieldType.FLOAT);
public static final Field PREVIOUSERROR = Field.create("PREVIOUSERROR", 24, FieldType.FLOAT);
public static final Field[] VALUES = {
ITERM,
DTERM,
@ -19,5 +20,6 @@ public class PidState {
INPUT,
OUTPUT,
ERRORAMPLIFICATIONCOEF,
PREVIOUSERROR,
};
}

View File

@ -16,11 +16,16 @@ public class ElectronicThrottleMeta {
new TextRequest("Feed_forward"),
new FieldRequest("Engine", "etbFeedForward"),
new TextRequest("eol"),
new TextRequest("input"),
new FieldRequest("ETB_pid", "input"),
new TextRequest("Output"),
new FieldRequest("ETB_pid", "output"),
new TextRequest("iTerm"),
new FieldRequest("ETB_pid", "iTerm"),
new TextRequest("eol"),
new FieldRequest("ETB_pid", "errorAmplificationCoef"),
new FieldRequest("ETB_pid", "previousError"),
new TextRequest("eol"),
new TextRequest("Settings"),
new ConfigRequest("ETB_PFACTOR"),
new ConfigRequest("ETB_IFACTOR"),
@ -28,6 +33,9 @@ public class ElectronicThrottleMeta {
new TextRequest("eol"),
new ConfigRequest("ETB_OFFSET"),
new ConfigRequest("ETB_PERIODMS"),
new TextRequest("eol"),
new ConfigRequest("ETB_MINVALUE"),
new ConfigRequest("ETB_MAXVALUE"),
},
new Request[]{
new TextRequest("No_Pedal_Sensor"),

View File

@ -0,0 +1,23 @@
package com.rusefi.ui.livedocs;
import javax.swing.*;
import java.awt.*;
/**
* (c) Andrey Belomutskiy 2013-2019
*/
public class LessJumpyJLabel extends JLabel {
private int maxPreferredWidth = 0;
public LessJumpyJLabel(String text) {
super(text);
}
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
// let's occupy maximum width we ever wanted to reduce layout jumpiness
maxPreferredWidth = Math.max(maxPreferredWidth, preferredSize.width);
return new Dimension(maxPreferredWidth, preferredSize.height);
}
}

View File

@ -77,7 +77,7 @@ public class LiveDocPanel {
FieldRequest request = (FieldRequest) r;
LiveDataContext context = getFieldContext(defaultContext, request.getStateContext());
Field field = getField(defaultContext, request);
JLabel label = new JLabel("*");
JLabel label = new LessJumpyJLabel("*");
label.setIcon(UiUtils.loadIcon("livedocs/variable.png"));
label.setToolTipText("Variable " + field.getName());
result.addControl(label);
@ -85,7 +85,7 @@ public class LiveDocPanel {
@Override
public void refresh(BinaryProtocol bp, byte[] response) {
Number fieldValue = field.getValue(new ConfigurationImage(response));
String value = niceToString(fieldValue);
String value = Field.niceToString(fieldValue, LIVE_DATA_PRECISION);
label.setText(value);
}
});
@ -93,7 +93,7 @@ public class LiveDocPanel {
ConfigRequest request = (ConfigRequest) r;
Field field = Field.findField(Fields.VALUES, settingsInstancePrefix, request.getField());
JLabel label = new JLabel("*");
JLabel label = new LessJumpyJLabel("*");
label.setIcon(UiUtils.loadIcon("livedocs/setting.png"));
label.setToolTipText(getTooltipText(field.getName()));
result.addControl(label);
@ -108,7 +108,7 @@ public class LiveDocPanel {
} else if (r instanceof SensorRequest) {
SensorRequest request = (SensorRequest) r;
Sensor sensor = Sensor.find(request.getValue());
JLabel label = new JLabel("*");
JLabel label = new LessJumpyJLabel("*");
label.setIcon(UiUtils.loadIcon("livedocs/gauge.png"));
label.setToolTipText("Sensor " + request.getValue());
label.addMouseListener(new MouseAdapter() {
@ -174,7 +174,7 @@ public class LiveDocPanel {
JPanel result = new JPanel(new VerticalFlowLayout());
JLabel conditionLabel = new JLabel(request.getField());
JLabel conditionLabel = new LessJumpyJLabel(request.getField());
result.add(conditionLabel);