auto-sync

This commit is contained in:
rusEfi 2016-07-19 22:03:16 -04:00
parent d5cdd33ac7
commit ca393a8952
7 changed files with 22 additions and 3 deletions

View File

@ -126,7 +126,8 @@ typedef struct {
float speedToRpmRatio; // 232
int warningCounter; // 236
int lastErrorCode; // 240
int unused3[8];
float inrernalMcuTemperature; // 244
int unused3[7];
} TunerStudioOutputChannels;
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */

View File

@ -675,6 +675,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->checkEngine = hasErrorCodes();
#if EFI_PROD_CODE || defined(__DOXYGEN__)
tsOutputChannels->inrernalMcuTemperature = getMCUInternalTemperature();
tsOutputChannels->idlePosition = getIdlePosition();
tsOutputChannels->isTriggerError = isTriggerErrorNow();

View File

@ -439,6 +439,7 @@ typedef enum {
EFI_ADC_14 = 14, // PC4
EFI_ADC_15 = 15, // PC5
// todo: bad choice of value since now we have ADC_CHANNEL_SENSOR and could end up with 17 and 18 also
EFI_ADC_NONE = 16,
EFI_ADC_ERROR = 999,

View File

@ -103,10 +103,12 @@ ADC_TwoSamplingDelay_20Cycles, // cr1
ADC_SMPR1_SMP_AN12(ADC_SAMPLING_SLOW) |
ADC_SMPR1_SMP_AN13(ADC_SAMPLING_SLOW) |
ADC_SMPR1_SMP_AN14(ADC_SAMPLING_SLOW) |
ADC_SMPR1_SMP_AN15(ADC_SAMPLING_SLOW)
ADC_SMPR1_SMP_AN15(ADC_SAMPLING_SLOW) |
ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144)
, // sample times for channels 10...18
ADC_SMPR2_SMP_AN0(ADC_SAMPLING_SLOW) |
ADC_SMPR2_SMP_AN1(ADC_SAMPLING_SLOW) |
ADC_SMPR2_SMP_AN2(ADC_SAMPLING_SLOW) |
ADC_SMPR2_SMP_AN3(ADC_SAMPLING_SLOW) |
ADC_SMPR2_SMP_AN4(ADC_SAMPLING_SLOW) |
ADC_SMPR2_SMP_AN5(ADC_SAMPLING_SLOW) |
@ -203,6 +205,15 @@ static void pwmpcb_fast(PWMDriver *pwmp) {
#endif
}
float getMCUInternalTemperature(void) {
float TemperatureValue = adcToVolts(slowAdc.getAdcValueByHwChannel(ADC_CHANNEL_SENSOR));
TemperatureValue -= 0.760; // Subtract the reference voltage at 25°C
TemperatureValue /= .0025; // Divide by slope 2.5mV
TemperatureValue += 25.0; // Add the 25°C
return TemperatureValue;
}
int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
if (hwChannel == EFI_ADC_NONE) {
warning(CUSTOM_OBD_38, "ADC: %s input is not configured", msg);
@ -544,6 +555,7 @@ void initAdcInputs(bool boardTestMode) {
*/
adcStart(&ADC_SLOW_DEVICE, NULL);
adcStart(&ADC_FAST_DEVICE, NULL);
adcSTM32EnableTSVREFE(); // Internal temperature sensor
for (int adc = 0; adc < HW_MAX_ADC_INDEX; adc++) {
adc_channel_mode_e mode = adcHwChannelEnabled[adc];
@ -558,6 +570,8 @@ void initAdcInputs(bool boardTestMode) {
}
}
// Internal temperature sensor, Available on ADC1 only
slowAdc.enableChannel((adc_channel_e)ADC_CHANNEL_SENSOR);
slowAdc.init();
pwmStart(EFI_INTERNAL_SLOW_ADC_PWM, &pwmcfg_slow);

View File

@ -26,6 +26,7 @@ int getAdcHardwareIndexByInternalIndex(int index);
void printFullAdcReportIfNeeded(void);
int getInternalAdcValue(const char *msg, adc_channel_e index);
float getMCUInternalTemperature(void);
// max(ADC_BUF_DEPTH_SLOW, ADC_BUF_DEPTH_FAST)
#define MAX_ADC_GRP_BUF_DEPTH 8

View File

@ -125,6 +125,7 @@ public enum Sensor {
RPM(SensorCategory.SENSOR_INPUTS, FieldType.INT, 0, BackgroundColor.RED, 0, 8000),
TIME_SECONDS(SensorCategory.OPERATIONS, FieldType.INT, 224, BackgroundColor.MUD, 0, 5),
SPEED2RPM(SensorCategory.SENSOR_INPUTS, FieldType.FLOAT, 232, BackgroundColor.MUD, 0, 5),
INT_TEMP(SensorCategory.OPERATIONS, FieldType.FLOAT, 244, BackgroundColor.MUD, 0, 5),
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),

View File

@ -39,7 +39,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20160716;
public static final int CONSOLE_VERSION = 20160719;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";