auto-sync

This commit is contained in:
rusEfi 2016-01-22 13:02:51 -05:00
parent d00c2ce819
commit 6d675d2794
8 changed files with 37 additions and 24 deletions

View File

@ -53,7 +53,7 @@ typedef struct {
* With all corrections. See also baseFuel
*/
float pulseWidthMs; // 64
float unused68; // 68
float debugFloatField; // 68
/**
* Yes, I do not really enjoy packing bits into integers but we simply have too many boolean flags and I cannot
* water 4 bytes per traffic - I want gauges to work as fast as possible
@ -104,12 +104,13 @@ typedef struct {
float wallFuelAmount; // 160
float iatCorrection; // 164
floatms_t wallFuelCorrection; // 168
float idlePosition;
float currentTargetAfr;
float chargeAirMass;
float cltCorrection;
float runningFuel;
int unused3[1];
float idlePosition; // 172
float currentTargetAfr; // 176
float chargeAirMass; // 180
float cltCorrection; // 184
float runningFuel; // 188
int debugIntField; // 192
int unused3[20];
} TunerStudioOutputChannels;
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */

View File

@ -105,6 +105,10 @@ static fuel_table_t alphaNfuel = {
static volatile int globalConfigurationVersion = 0;
/**
* This counter is incremented every time user adjusts ECU parameters online (either via dev console or other
* tuning software)
*/
int getGlobalConfigurationVersion(void) {
return globalConfigurationVersion;
}

View File

@ -1,5 +1,5 @@
#define LE_COMMAND_LENGTH 200
#define TS_FILE_VERSION 20151201
#define TS_FILE_VERSION 20160122
#define MAP_ANGLE_SIZE 8
#define MAP_WINDOW_SIZE 8
#define CLT_CURVE_SIZE 16

View File

@ -15,6 +15,7 @@
#include "pin_repository.h"
#include "voltage.h"
#include "pid.h"
#include "LocalVersionHolder.h"
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
@ -34,11 +35,21 @@ static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE)
static float currentAltDuty;
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
static LocalVersionHolder parametersVersion;
extern TunerStudioOutputChannels tsOutputChannels;
#endif
static msg_t AltCtrlThread(int param) {
UNUSED(param);
UNUSED(param);
chRegSetThreadName("AlternatorController");
while (true) {
int dt = maxI(20, engineConfiguration->alternatorDT);
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
if (parametersVersion.isOld())
altPid.reset();
#endif
int dt = maxI(10, engineConfiguration->alternatorDT);
chThdSleepMilliseconds(dt);
currentAltDuty = engineConfiguration->alternatorOffset + altPid.getValue(engineConfiguration->targetVBatt, getVBatt(PASS_ENGINE_PARAMETER_F), 1);
@ -47,6 +58,10 @@ static msg_t AltCtrlThread(int param) {
altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration());
}
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
tsOutputChannels.debugFloatField = currentAltDuty;
#endif
alternatorControl.setSimplePwmDutyCycle(currentAltDuty / 100);
}
#if defined __GNUC__
@ -54,9 +69,6 @@ static msg_t AltCtrlThread(int param) {
#endif
}
static void applySettings(void) {
altPid.updateFactors(engineConfiguration->alternatorControl.pFactor, 0, 0);
}
void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled),
@ -71,7 +83,7 @@ void showAltInfo(void) {
void setAltPFactor(float p) {
engineConfiguration->alternatorControl.pFactor = p;
scheduleMsg(logger, "setAltPid: %f", p);
applySettings();
altPid.reset();
showAltInfo();
}
@ -107,10 +119,6 @@ void initAlternatorCtrl(Logging *sharedLogger) {
ALTERNATOR_VALVE_PWM_FREQUENCY, 0.1, applyAlternatorPinState);
chThdCreateStatic(alternatorControlThreadStack, sizeof(alternatorControlThreadStack), LOWPRIO,
(tfunc_t) AltCtrlThread, NULL);
addConsoleActionF("set_alt_p", setAltPFactor);
applySettings();
}
#endif /* EFI_ALTERNATOR_CONTROL */

View File

@ -20,7 +20,7 @@ struct_no_prefix engine_configuration_s
!
! this is used to confirm that firmware and TunerStudio are using the same rusefi.ini version
!
#define TS_FILE_VERSION 20151201
#define TS_FILE_VERSION 20160122
#define MAP_ANGLE_SIZE 8

View File

@ -41,7 +41,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 12:32:32 EST 2016
pageSize = 16088
page = 1
@ -619,7 +619,7 @@ fileVersion = { 20151201 }
ochGetCommand = "O"
; see OUTPUT_CHANNELS_SIZE in console source code
ochBlockSize = 196
ochBlockSize = 276
rpm = scalar, U32, 0, "RPM", 1, 0.00000
#if CELSIUS

View File

@ -34,7 +34,7 @@ import static com.rusefi.binaryprotocol.IoHelper.*;
*/
public class BinaryProtocol {
// todo: is this auto-synched with rusefi.ini?
public static final int OUTPUT_CHANNELS_SIZE = 196;
public static final int OUTPUT_CHANNELS_SIZE = 276;
private static final int BLOCKING_FACTOR = 256;
private static final byte RESPONSE_OK = 0;

View File

@ -1,9 +1,9 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 17 23:49:17 EST 2016
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 12:32:32 EST 2016
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int TS_FILE_VERSION = 20151201;
public static final int TS_FILE_VERSION = 20160122;
public static final int MAP_ANGLE_SIZE = 8;
public static final int MAP_WINDOW_SIZE = 8;
public static final int CLT_CURVE_SIZE = 16;