mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
2fc291fb93
commit
0e833c4e35
|
@ -89,8 +89,7 @@
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
// todo: eliminate this magic constant, read from some relevant offset
|
extern persistent_config_container_s persistentState;
|
||||||
#define LIVE_TUNING 6200
|
|
||||||
|
|
||||||
extern short currentPageId;
|
extern short currentPageId;
|
||||||
|
|
||||||
|
@ -242,10 +241,15 @@ void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
||||||
tsSendResponse(tsChannel, mode, NULL, 0);
|
tsSendResponse(tsChannel, mode, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void yellowMagic(int currentPageId, int offset, int count) {
|
static void onlineTuneBytes(int currentPageId, int offset, int count) {
|
||||||
if (offset > LIVE_TUNING) {
|
if (offset > sizeof(engine_configuration_s)) {
|
||||||
|
int maxSize = sizeof(engine_configuration_s) - offset;
|
||||||
|
if (count > maxSize) {
|
||||||
|
warning(CUSTOM_OBD_99, "TS overflow %d %d", offset, count);
|
||||||
|
return;
|
||||||
|
}
|
||||||
scheduleMsg(&tsLogger, "applying soft change from %d length %d", offset, count);
|
scheduleMsg(&tsLogger, "applying soft change from %d length %d", offset, count);
|
||||||
memcpy(((char*) engineConfiguration) + offset, ((char*) &configWorkingCopy.engineConfiguration) + offset,
|
memcpy(((char*) &persistentState.persistentConfiguration) + offset, ((char*) &configWorkingCopy) + offset,
|
||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,7 +287,7 @@ void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
||||||
|
|
||||||
uint8_t * addr = (uint8_t *) (getWorkingPageAddr(currentPageId) + offset);
|
uint8_t * addr = (uint8_t *) (getWorkingPageAddr(currentPageId) + offset);
|
||||||
memcpy(addr, content, count);
|
memcpy(addr, content, count);
|
||||||
yellowMagic(currentPageId, offset, count);
|
onlineTuneBytes(currentPageId, offset, count);
|
||||||
|
|
||||||
tsSendResponse(tsChannel, mode, NULL, 0);
|
tsSendResponse(tsChannel, mode, NULL, 0);
|
||||||
}
|
}
|
||||||
|
@ -339,7 +343,7 @@ void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
||||||
|
|
||||||
getWorkingPageAddr(currentPageId)[offset] = value;
|
getWorkingPageAddr(currentPageId)[offset] = value;
|
||||||
|
|
||||||
yellowMagic(currentPageId, offset, 1);
|
onlineTuneBytes(currentPageId, offset, 1);
|
||||||
|
|
||||||
// scheduleMsg(logger, "va=%d", configWorkingCopy.boardConfiguration.idleValvePin);
|
// scheduleMsg(logger, "va=%d", configWorkingCopy.boardConfiguration.idleValvePin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ Engine::Engine(persistent_config_s *config) {
|
||||||
isEngineChartEnabled = false;
|
isEngineChartEnabled = false;
|
||||||
sensorChartMode = SC_OFF;
|
sensorChartMode = SC_OFF;
|
||||||
actualLastInjection = 0;
|
actualLastInjection = 0;
|
||||||
|
fuelScheduleForThisEngineCycle = NULL;
|
||||||
|
isAlternatorControlEnabled = false;
|
||||||
|
wallFuelCorrection = 0;
|
||||||
/**
|
/**
|
||||||
* it's important for fixAngle() that engineCycle field never has zero
|
* it's important for fixAngle() that engineCycle field never has zero
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,6 +28,7 @@ InjectionEvent::InjectionEvent() {
|
||||||
isSimultanious = false;
|
isSimultanious = false;
|
||||||
isOverlapping = false;
|
isOverlapping = false;
|
||||||
injectorIndex = 0;
|
injectorIndex = 0;
|
||||||
|
output = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_trigger_position_s::event_trigger_position_s() {
|
event_trigger_position_s::event_trigger_position_s() {
|
||||||
|
|
|
@ -40,6 +40,9 @@ extern engine_pins_s enginePins;
|
||||||
* @return number of milliseconds in one crank shaft revolution
|
* @return number of milliseconds in one crank shaft revolution
|
||||||
*/
|
*/
|
||||||
floatms_t getCrankshaftRevolutionTimeMs(int rpm) {
|
floatms_t getCrankshaftRevolutionTimeMs(int rpm) {
|
||||||
|
if (rpm == 0) {
|
||||||
|
return NAN;
|
||||||
|
}
|
||||||
return 360 * getOneDegreeTimeMs(rpm);
|
return 360 * getOneDegreeTimeMs(rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue