Merge branch 'master' of https://github.com/rusefi/rusefi
This commit is contained in:
commit
46f85e93d4
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Dec 21 19:54:17 EST 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Mon Dec 30 01:38:03 EST 2019
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
|
||||
|
@ -2052,7 +2052,11 @@ struct engine_configuration_s {
|
|||
/**
|
||||
* offset 1772
|
||||
*/
|
||||
uint8_t unusedFormerWarmupAfrPid[4];
|
||||
uint8_t unusedFormerWarmupAfrPid[3];
|
||||
/**
|
||||
* offset 1775
|
||||
*/
|
||||
uint8_t tachPulsePerRev;
|
||||
/**
|
||||
* kPa value which is too low to be true
|
||||
* offset 1776
|
||||
|
@ -3108,4 +3112,4 @@ typedef struct persistent_config_s persistent_config_s;
|
|||
|
||||
#endif
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Dec 21 19:54:17 EST 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Mon Dec 30 01:38:03 EST 2019
|
||||
|
|
|
@ -1726,6 +1726,8 @@
|
|||
#define tachPulseDuractionMs_offset_hex 6a8
|
||||
#define tachPulseDurationAsDutyCycle_offset 1464
|
||||
#define tachPulseDurationAsDutyCycle_offset_hex 5b8
|
||||
#define tachPulsePerRev_offset 1775
|
||||
#define tachPulsePerRev_offset_hex 6ef
|
||||
#define tachPulseTriggerIndex_offset 1708
|
||||
#define tachPulseTriggerIndex_offset_hex 6ac
|
||||
#define targetVBatt_offset 2024
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file config/boards/kinetis/rusefi_hw_enums.h
|
||||
*
|
||||
* @date Jun 2, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
* @author andreika <prometheus.pcb@gmail.com>
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* @brief In this file we can override engine_configuration.cpp.
|
||||
*
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
#include "global.h"
|
||||
#include "engine.h"
|
||||
|
|
|
@ -44,11 +44,14 @@ analog_inputs:
|
|||
EFI_ADC_4: "28 - AN volt 10"
|
||||
EFI_ADC_6: "26 - AN volt 2"
|
||||
EFI_ADC_7: "31 - AN volt 3"
|
||||
# PB0
|
||||
EFI_ADC_8: "36 - AN volt 8"
|
||||
# PB1
|
||||
EFI_ADC_9: "40 - AN volt 9"
|
||||
EFI_ADC_10: "27 - AN volt 1"
|
||||
EFI_ADC_11: "Battery Sense"
|
||||
EFI_ADC_12: "19 - AN volt 4"
|
||||
# PC3
|
||||
EFI_ADC_13: "20 - AN volt 5"
|
||||
EFI_ADC_14: "32 - AN volt 6"
|
||||
EFI_ADC_15: "30 - AN volt 7"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file chconf_common.h
|
||||
*
|
||||
* @date Apr 20, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_CHCONF_COMMON_H_
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* @date Feb 13, 2014
|
||||
* @author rus084, (c) 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* @date 13 Feb 2014
|
||||
* @author rus084
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef GY6_139QMB_H_
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
* https://raw.githubusercontent.com/wiki/rusefi/rusefi_documentation/oem_docs/VAG/Bosch_0280750009_pinout.jpg
|
||||
*
|
||||
* @date Nov 1, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "engine_template.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file engine_template.h
|
||||
*
|
||||
* @date Nov 1, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
* Frankenso QA 12 cylinder engine
|
||||
*
|
||||
* @date Jan 18, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
#ifndef CONFIG_ENGINES_CUSTOM_ENGINE_CPP_
|
||||
#define CONFIG_ENGINES_CUSTOM_ENGINE_CPP_
|
||||
|
||||
#include "custom_engine.h"
|
||||
#include "allsensors.h"
|
||||
|
@ -41,11 +39,11 @@ static int test557[] = {5, 5, 10, 10, 20, 20, 50, 50, 100, 100, 200, 200, 500, 5
|
|||
|
||||
efitimeus_t testTime;
|
||||
|
||||
static void toggleTestAndScheduleNext() {
|
||||
static void toggleTestAndScheduleNext(void *) {
|
||||
testPin.toggle();
|
||||
periodIndex = (periodIndex + 1) % TEST_LEN;
|
||||
testTime += test557[periodIndex];
|
||||
engine->executor.scheduleByTimestamp(&scheduling, testTime, (schfunc_t) &toggleTestAndScheduleNext, NULL);
|
||||
engine->executor.scheduleByTimestamp(&scheduling, testTime, &toggleTestAndScheduleNext);
|
||||
|
||||
}
|
||||
|
||||
|
@ -60,8 +58,7 @@ void runSchedulingPrecisionTestIfNeeded(void) {
|
|||
testPin.initPin("test", engineConfiguration->test557pin);
|
||||
testPin.setValue(0);
|
||||
testTime = getTimeNowUs();
|
||||
toggleTestAndScheduleNext();
|
||||
|
||||
toggleTestAndScheduleNext(/*unused*/ nullptr);
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
|
@ -298,11 +295,14 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// see also setDefaultEtbBiasCurve
|
||||
}
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
void setIssue898(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
// TLE8888_BENCH_ENGINE
|
||||
// todo: remove this? this was used to play with "secret" red boards prior to MRE reality
|
||||
// set engine_type 59
|
||||
void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
engineConfiguration->specs.cylindersCount = 8;
|
||||
|
@ -394,6 +394,7 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
|
||||
/**
|
||||
* This configuration is used for MRE board Quality Assurance validation
|
||||
* set engine_type 30
|
||||
*/
|
||||
void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
|
@ -507,5 +508,3 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
engineConfiguration->injectionPins[2 - 1] = GPIOE_10;
|
||||
#endif /* BOARD_TLE8888_COUNT */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ENGINES_CUSTOM_ENGINE_CPP_ */
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* @file custom_engine.h
|
||||
*
|
||||
* @date Jan 18, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
#ifndef CONFIG_ENGINES_CUSTOM_ENGINE_H_
|
||||
#define CONFIG_ENGINES_CUSTOM_ENGINE_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
|
@ -20,4 +20,4 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
|||
void setIssue898(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
#endif /* CONFIG_ENGINES_CUSTOM_ENGINE_H_ */
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file engine_template.cpp
|
||||
*
|
||||
* @date
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "engine_template.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file engine_template.h
|
||||
*
|
||||
* @date
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* MAZDA_MIATA_2003_NA_RAIL
|
||||
*
|
||||
* @date Sep 20, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "mazda_miata_vvt.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* COP ion #3 GPIOD_9
|
||||
*
|
||||
* @date Oct 4, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
* http://rusefi.com/forum/viewtopic.php?f=3&t=1095
|
||||
*
|
||||
*
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* set engine_type 5
|
||||
*
|
||||
* @date Oct 14, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file nissan_primera.h
|
||||
*
|
||||
* @date Oct 14, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* set engine_type 32
|
||||
*
|
||||
* @date May 24, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file vw.h
|
||||
*
|
||||
* @date May 24, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file vw_b6.cpp
|
||||
*
|
||||
* @date Dec 26, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "engine.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file vw_b6.h
|
||||
*
|
||||
* @date Dec 26, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @brief In this header we can configure which firmware modules are used.
|
||||
*
|
||||
* @date Aug 29, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -108,8 +108,6 @@ EXTERN_ENGINE
|
|||
|
||||
extern persistent_config_container_s persistentState;
|
||||
|
||||
extern short currentPageId;
|
||||
|
||||
/**
|
||||
* note the use-case where text console port is switched into
|
||||
* binary port
|
||||
|
@ -140,9 +138,8 @@ static void printErrorCounters(void) {
|
|||
scheduleMsg(&tsLogger, "TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d",
|
||||
sizeof(tsOutputChannels), tsState.totalCounter, tsState.errorCounter, tsState.queryCommandCounter,
|
||||
tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter);
|
||||
scheduleMsg(&tsLogger, "TunerStudio W=%d / C=%d / P=%d / page=%d", tsState.writeValueCommandCounter,
|
||||
tsState.writeChunkCommandCounter, tsState.pageCommandCounter, currentPageId);
|
||||
// scheduleMsg(&tsLogger, "page size=%d", getTunerStudioPageSize(currentPageId));
|
||||
scheduleMsg(&tsLogger, "TunerStudio W=%d / C=%d / P=%d", tsState.writeValueCommandCounter,
|
||||
tsState.writeChunkCommandCounter, tsState.pageCommandCounter);
|
||||
}
|
||||
|
||||
void printTsStats(void) {
|
||||
|
@ -200,33 +197,36 @@ void tunerStudioDebug(const char *msg) {
|
|||
#endif /* EFI_TUNER_STUDIO_VERBOSE */
|
||||
}
|
||||
|
||||
char *getWorkingPageAddr(int pageIndex) {
|
||||
switch (pageIndex) {
|
||||
case 0:
|
||||
char *getWorkingPageAddr() {
|
||||
#ifndef EFI_NO_CONFIG_WORKING_COPY
|
||||
return (char*) &configWorkingCopy.engineConfiguration;
|
||||
return (char*) &configWorkingCopy.engineConfiguration;
|
||||
#else
|
||||
return (char*) engineConfiguration;
|
||||
return (char*) engineConfiguration;
|
||||
#endif /* EFI_NO_CONFIG_WORKING_COPY */
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int getTunerStudioPageSize(int pageIndex) {
|
||||
return pageIndex ? 0 : TOTAL_CONFIG_SIZE;
|
||||
static constexpr size_t getTunerStudioPageSize() {
|
||||
return TOTAL_CONFIG_SIZE;
|
||||
}
|
||||
|
||||
static void sendOkResponse(ts_channel_s *tsChannel, ts_response_format_e mode) {
|
||||
sr5SendResponse(tsChannel, mode, NULL, 0);
|
||||
}
|
||||
|
||||
static void sendErrorCode(ts_channel_s *tsChannel) {
|
||||
sr5WriteCrcPacket(tsChannel, TS_RESPONSE_CRC_FAILURE, NULL, 0);
|
||||
}
|
||||
|
||||
void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId) {
|
||||
tsState.pageCommandCounter++;
|
||||
|
||||
currentPageId = pageId;
|
||||
scheduleMsg(&tsLogger, "PAGE %d", currentPageId);
|
||||
sendOkResponse(tsChannel, mode);
|
||||
scheduleMsg(&tsLogger, "PAGE %d", pageId);
|
||||
|
||||
if (pageId == 0) {
|
||||
sendOkResponse(tsChannel, mode);
|
||||
} else {
|
||||
sendErrorCode(tsChannel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,8 +241,7 @@ void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
|||
* On the contrary, 'hard parameters' are waiting for the Burn button to be clicked and configuration version
|
||||
* would be increased and much more complicated logic would be executed.
|
||||
*/
|
||||
static void onlineApplyWorkingCopyBytes(int currentPageId, uint32_t offset, int count) {
|
||||
UNUSED(currentPageId);
|
||||
static void onlineApplyWorkingCopyBytes(uint32_t offset, int count) {
|
||||
if (offset >= sizeof(engine_configuration_s)) {
|
||||
int maxSize = sizeof(persistent_config_s) - offset;
|
||||
if (count > maxSize) {
|
||||
|
@ -302,11 +301,23 @@ static void handleGetStructContent(ts_channel_s *tsChannel, int structId, int si
|
|||
sr5SendResponse(tsChannel, TS_CRC, (const uint8_t *)addr, size);
|
||||
}
|
||||
|
||||
// Validate whether the specified offset and count would cause an overrun in the tune.
|
||||
// Returns true if an overrun would occur.
|
||||
static bool validateOffsetCount(size_t offset, size_t count, ts_channel_s *tsChannel) {
|
||||
if (offset + count > getTunerStudioPageSize()) {
|
||||
scheduleMsg(&tsLogger, "ERROR invalid offset %d count %d", offset, count);
|
||||
tunerStudioError("ERROR: out of range");
|
||||
sendErrorCode(tsChannel);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* read log file content for rusEfi console
|
||||
*/
|
||||
static void handleReadFileContent(ts_channel_s *tsChannel, short fileId, short offset, short length) {
|
||||
static void handleReadFileContent(ts_channel_s *tsChannel, short fileId, uint16_t offset, uint16_t length) {
|
||||
//#if EFI_FILE_LOGGING
|
||||
// readLogFileContent(tsChannel->crcReadBuffer, fileId, offset, length);
|
||||
//#else
|
||||
|
@ -318,42 +329,34 @@ static void handleReadFileContent(ts_channel_s *tsChannel, short fileId, short o
|
|||
* This command is needed to make the whole transfer a bit faster
|
||||
* @note See also handleWriteValueCommand
|
||||
*/
|
||||
void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, short offset, short count,
|
||||
void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count,
|
||||
void *content) {
|
||||
tsState.writeChunkCommandCounter++;
|
||||
|
||||
scheduleMsg(&tsLogger, "WRITE CHUNK mode=%d p=%d o=%d s=%d", mode, currentPageId, offset, count);
|
||||
scheduleMsg(&tsLogger, "WRITE CHUNK mode=%d o=%d s=%d", mode, offset, count);
|
||||
|
||||
if (offset > getTunerStudioPageSize(currentPageId)) {
|
||||
scheduleMsg(&tsLogger, "ERROR invalid offset %d", offset);
|
||||
tunerStudioError("ERROR: out of range");
|
||||
offset = 0;
|
||||
if (validateOffsetCount(offset, count, tsChannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count > getTunerStudioPageSize(currentPageId)) {
|
||||
tunerStudioError("ERROR: unexpected count");
|
||||
scheduleMsg(&tsLogger, "ERROR unexpected count %d", count);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
uint8_t * addr = (uint8_t *) (getWorkingPageAddr(currentPageId) + offset);
|
||||
uint8_t * addr = (uint8_t *) (getWorkingPageAddr() + offset);
|
||||
memcpy(addr, content, count);
|
||||
onlineApplyWorkingCopyBytes(currentPageId, offset, count);
|
||||
onlineApplyWorkingCopyBytes(offset, count);
|
||||
|
||||
sendOkResponse(tsChannel, mode);
|
||||
}
|
||||
|
||||
void handleCrc32Check(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset,
|
||||
uint16_t count) {
|
||||
UNUSED(pageId);
|
||||
|
||||
tsState.crc32CheckCommandCounter++;
|
||||
|
||||
count = SWAP_UINT16(count);
|
||||
count = getTunerStudioPageSize();
|
||||
|
||||
count = getTunerStudioPageSize(pageId);
|
||||
scheduleMsg(&tsLogger, "CRC32 request: offset %d size %d", offset, count);
|
||||
|
||||
scheduleMsg(&tsLogger, "CRC32 request: pageId %d offset %d size %d", pageId, offset, count);
|
||||
|
||||
uint32_t crc = SWAP_UINT32(crc32((void * ) getWorkingPageAddr(0), count));
|
||||
uint32_t crc = SWAP_UINT32(crc32((void * ) getWorkingPageAddr(), count));
|
||||
|
||||
scheduleMsg(&tsLogger, "CRC32 response: %x", crc);
|
||||
|
||||
|
@ -368,9 +371,9 @@ void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
|||
uint8_t value) {
|
||||
UNUSED(tsChannel);
|
||||
UNUSED(mode);
|
||||
tsState.writeValueCommandCounter++;
|
||||
UNUSED(page);
|
||||
|
||||
currentPageId = page;
|
||||
tsState.writeValueCommandCounter++;
|
||||
|
||||
tunerStudioDebug("got W (Write)"); // we can get a lot of these
|
||||
|
||||
|
@ -378,58 +381,42 @@ void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
|
|||
// scheduleMsg(logger, "Page number %d\r\n", pageId); // we can get a lot of these
|
||||
#endif
|
||||
|
||||
// int size = sizeof(TunerStudioWriteValueRequest);
|
||||
// scheduleMsg(logger, "Reading %d\r\n", size);
|
||||
|
||||
if (offset > getTunerStudioPageSize(currentPageId)) {
|
||||
tunerStudioError("ERROR: out of range2");
|
||||
scheduleMsg(&tsLogger, "ERROR offset %d", offset);
|
||||
offset = 0;
|
||||
if (validateOffsetCount(offset, 1, tsChannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
efitimems_t nowMs = currentTimeMillis();
|
||||
if (nowMs - previousWriteReportMs > 5) {
|
||||
previousWriteReportMs = nowMs;
|
||||
scheduleMsg(&tsLogger, "page %d offset %d: value=%d", currentPageId, offset, value);
|
||||
scheduleMsg(&tsLogger, "offset %d: value=%d", offset, value);
|
||||
}
|
||||
|
||||
getWorkingPageAddr(currentPageId)[offset] = value;
|
||||
getWorkingPageAddr()[offset] = value;
|
||||
|
||||
onlineApplyWorkingCopyBytes(currentPageId, offset, 1);
|
||||
onlineApplyWorkingCopyBytes(offset, 1);
|
||||
|
||||
// scheduleMsg(logger, "va=%d", configWorkingCopy.boardConfiguration.idleValvePin);
|
||||
}
|
||||
|
||||
static void sendErrorCode(ts_channel_s *tsChannel) {
|
||||
sr5WriteCrcPacket(tsChannel, TS_RESPONSE_CRC_FAILURE, NULL, 0);
|
||||
}
|
||||
|
||||
void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset,
|
||||
uint16_t count) {
|
||||
tsState.readPageCommandsCounter++;
|
||||
currentPageId = pageId;
|
||||
|
||||
#if EFI_TUNER_STUDIO_VERBOSE
|
||||
scheduleMsg(&tsLogger, "READ mode=%d page=%d offset=%d size=%d", mode, (int) currentPageId, offset, count);
|
||||
scheduleMsg(&tsLogger, "READ mode=%d offset=%d size=%d", mode, offset, count);
|
||||
#endif
|
||||
|
||||
if (currentPageId >= PAGE_COUNT) {
|
||||
if (pageId != 0) {
|
||||
// something is not right here
|
||||
currentPageId = 0;
|
||||
tunerStudioError("ERROR: invalid page number");
|
||||
return;
|
||||
}
|
||||
|
||||
int size = getTunerStudioPageSize(currentPageId);
|
||||
|
||||
if (size < offset + count) {
|
||||
scheduleMsg(&tsLogger, "invalid offset/count %d/%d", offset, count);
|
||||
sendErrorCode(tsChannel);
|
||||
if (validateOffsetCount(offset, count, tsChannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t *addr = (const uint8_t *) (getWorkingPageAddr(currentPageId) + offset);
|
||||
const uint8_t *addr = (const uint8_t *) (getWorkingPageAddr() + offset);
|
||||
sr5SendResponse(tsChannel, mode, addr, count);
|
||||
#if EFI_TUNER_STUDIO_VERBOSE
|
||||
// scheduleMsg(&tsLogger, "Sending %d done", count);
|
||||
|
@ -453,19 +440,13 @@ static void sendResponseCode(ts_response_format_e mode, ts_channel_s *tsChannel,
|
|||
* 'Burn' command is a command to commit the changes
|
||||
*/
|
||||
void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page) {
|
||||
UNUSED(page);
|
||||
|
||||
efitimems_t nowMs = currentTimeMillis();
|
||||
tsState.burnCommandCounter++;
|
||||
|
||||
scheduleMsg(&tsLogger, "got B (Burn) %s", mode == TS_PLAIN ? "plain" : "CRC");
|
||||
|
||||
currentPageId = page;
|
||||
|
||||
#if EFI_TUNER_STUDIO_VERBOSE
|
||||
// pointless since we only have one page now
|
||||
// scheduleMsg(logger, "Page number %d", currentPageId);
|
||||
#endif
|
||||
|
||||
// todo: how about some multi-threading?
|
||||
#if !defined(EFI_NO_CONFIG_WORKING_COPY)
|
||||
memcpy(&persistentState.persistentConfiguration, &configWorkingCopy, sizeof(persistent_config_s));
|
||||
#endif /* EFI_NO_CONFIG_WORKING_COPY */
|
||||
|
@ -626,8 +607,6 @@ void syncTunerStudioCopy(void) {
|
|||
tunerstudio_counters_s tsState;
|
||||
TunerStudioOutputChannels tsOutputChannels;
|
||||
|
||||
short currentPageId;
|
||||
|
||||
void tunerStudioError(const char *msg) {
|
||||
tunerStudioDebug(msg);
|
||||
printErrorCounters();
|
||||
|
@ -651,8 +630,8 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode) {
|
|||
* @brief 'Output' command sends out a snapshot of current values
|
||||
*/
|
||||
void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) {
|
||||
if (sizeof(TunerStudioOutputChannels) < offset + count) {
|
||||
scheduleMsg(&tsLogger, "invalid offset/count %d/%d", offset, count);
|
||||
if (offset + count > sizeof(TunerStudioOutputChannels)) {
|
||||
scheduleMsg(&tsLogger, "ERROR invalid offset %d count %d", offset, count);
|
||||
sendErrorCode(tsChannel);
|
||||
return;
|
||||
}
|
||||
|
@ -789,7 +768,6 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
|||
handleReadFileContent(tsChannel, data16[0], data16[1], data16[2]);
|
||||
break;
|
||||
case TS_CHUNK_WRITE_COMMAND:
|
||||
currentPageId = data16[0];
|
||||
handleWriteChunkCommand(tsChannel, TS_CRC, data16[1], data16[2], data + sizeof(TunerStudioWriteChunkRequest));
|
||||
break;
|
||||
case TS_SINGLE_WRITE_COMMAND:
|
||||
|
|
|
@ -50,8 +50,7 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode);
|
|||
*/
|
||||
void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode);
|
||||
|
||||
char *getWorkingPageAddr(int pageIndex);
|
||||
int getTunerStudioPageSize(int pageIndex);
|
||||
char *getWorkingPageAddr();
|
||||
void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page, uint16_t offset, uint8_t value);
|
||||
void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, short offset, short count, void *content);
|
||||
void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId);
|
||||
|
|
|
@ -56,8 +56,6 @@ using scaled_angle = scaled_channel<int16_t, PACK_MULT_ANGLE>; // +-655 degree
|
|||
using scaled_voltage = scaled_channel<uint16_t, PACK_MULT_VOLTAGE>; // 0-65v at 1mV resolution
|
||||
using scaled_afr = scaled_channel<uint16_t, PACK_MULT_AFR>; // 0-65afr at 0.001 resolution
|
||||
|
||||
#define PAGE_COUNT 1
|
||||
|
||||
typedef struct {
|
||||
uint16_t values[EGT_CHANNEL_COUNT];
|
||||
} egt_values_s;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file status_loop.h
|
||||
*
|
||||
* @date Mar 15, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file aux_pid.h
|
||||
*
|
||||
* @date Jun 26, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef CONTROLLERS_ALGO_AUX_PID_H_
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* @file electronic_throttle.cpp
|
||||
* @brief Electronic Throttle driver
|
||||
*
|
||||
*
|
||||
* Limited user documentation at https://github.com/rusefi/rusefi_documentation/wiki/HOWTO_electronic_throttle_body
|
||||
*
|
||||
* todo: make this more universal if/when we get other hardware options
|
||||
*
|
||||
* Sep 2019 two-wire TLE9201 official driving around the block! https://www.youtube.com/watch?v=1vCeICQnbzI
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file electronic_throttle.h
|
||||
*
|
||||
* @date Dec 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Idle Valve Control thread
|
||||
*
|
||||
* @date May 23, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -73,7 +73,7 @@ static void testCallback(void *arg) {
|
|||
/**
|
||||
* this would re-schedule another callback in 2ms from now
|
||||
*/
|
||||
engine->executor.scheduleForLater("test", &ioTest, MS2US(2), testCallback, NULL);
|
||||
engine->executor.scheduleForLater("test", &ioTest, MS2US(2), testCallback);
|
||||
}
|
||||
|
||||
void initPwmTester(void) {
|
||||
|
@ -97,7 +97,7 @@ void initPwmTester(void) {
|
|||
/**
|
||||
* this would schedule a callback in 2ms from now
|
||||
*/
|
||||
engine->executor.scheduleForLater("test", &ioTest, MS2US(2), testCallback, NULL);
|
||||
engine->executor.scheduleForLater("test", &ioTest, MS2US(2), testCallback);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file advance_map.cpp
|
||||
*
|
||||
* @date Mar 27, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* express myself in C/C++. I am open for suggestions :)
|
||||
*
|
||||
* @date May 21, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
@ -414,11 +414,6 @@ void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
enginePins.stopPins();
|
||||
}
|
||||
|
||||
void action_s::setAction(schfunc_t callback, void *param) {
|
||||
this->callback = callback;
|
||||
this->param = param;
|
||||
}
|
||||
|
||||
void action_s::execute() {
|
||||
efiAssertVoid(CUSTOM_ERR_ASSERT, callback != NULL, "callback==null1");
|
||||
callback(param);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file engine.h
|
||||
*
|
||||
* @date May 21, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* engine2.cpp
|
||||
*
|
||||
* @date Jan 5, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
// todo: move this code to more proper locations
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Utility method related to the engine configuration data structure.
|
||||
*
|
||||
* @date Nov 22, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
@ -1112,18 +1112,24 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
|
|||
case MRE_MIATA_NA6:
|
||||
setMiataNA6_VAF_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
#if EFI_UNIT_TEST
|
||||
case ISSUE_898:
|
||||
setIssue898(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
#endif
|
||||
case MRE_MIATA_NB2_MTB:
|
||||
setMiataNB2_MRE_MTB(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MRE_MIATA_NB2:
|
||||
setMiataNB2_MRE_ETB(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MICRO_RUS_EFI:
|
||||
// todo: is it time to replace MICRO_RUS_EFI, PROTEUS, PROMETHEUS_DEFAULTS with MINIMAL_PINS? maybe rename MINIMAL_PINS to DEFAULT?
|
||||
case PROTEUS:
|
||||
case PROMETHEUS_DEFAULTS:
|
||||
case MINIMAL_PINS:
|
||||
// all basic settings are already set in prepareVoidConfiguration(), no need to set anything here
|
||||
// nothing to do - we do it all in setBoardConfigurationOverrides
|
||||
break;
|
||||
case MRE_BOARD_TEST:
|
||||
mreBoardTest(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
@ -1171,10 +1177,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
|
|||
case ETB_BENCH_ENGINE:
|
||||
setEtbTestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MICRO_RUS_EFI:
|
||||
case PROTEUS:
|
||||
// nothing to do - we do it all in setBoardConfigurationOverrides
|
||||
break;
|
||||
case TLE8888_BENCH_ENGINE:
|
||||
setTle8888TestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Main engine configuration data structure.
|
||||
*
|
||||
* @date Oct 30, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file engine_parts.h
|
||||
*
|
||||
* @date May 27, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* See also FiringOrderTSLogic.java
|
||||
*
|
||||
* @date Jul 20, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "rusefi_enums.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @note this file should probably not include any other files
|
||||
*
|
||||
* @date Jan 14, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file rusefi_hw_enums.h
|
||||
*
|
||||
* @date Jun 2, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef RUSEFI_HW_ENUMS_H_
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file error_handling.cpp
|
||||
*
|
||||
* @date Apr 1, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* 'fsioinfo' command in console shows current state of FSIO - formulas and current value
|
||||
*
|
||||
* @date Oct 5, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief FSIO as it's used for GPIO
|
||||
*
|
||||
* @date Oct 5, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file state_sequence.h
|
||||
*
|
||||
* @date May 18, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
*
|
||||
* @date Feb 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
@ -839,6 +839,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20191222;
|
||||
return 201200107;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Controllers package entry point header
|
||||
*
|
||||
* @date Feb 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* https://github.com/rusefi/rusefi/issues/490
|
||||
*
|
||||
* @date Nov 25, 2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "engine_math.h"
|
||||
|
@ -34,8 +34,7 @@ void plainPinTurnOn(AuxActor *current) {
|
|||
scheduleOrQueue(¤t->open,
|
||||
TRIGGER_EVENT_UNDEFINED,
|
||||
current->extra + engine->engineState.auxValveStart,
|
||||
(schfunc_t)plainPinTurnOn,
|
||||
current
|
||||
{ plainPinTurnOn, current }
|
||||
PASS_ENGINE_PARAMETER_SUFFIX
|
||||
);
|
||||
|
||||
|
@ -46,8 +45,7 @@ void plainPinTurnOn(AuxActor *current) {
|
|||
scheduleOrQueue(¤t->close,
|
||||
TRIGGER_EVENT_UNDEFINED,
|
||||
current->extra + engine->engineState.auxValveEnd,
|
||||
(schfunc_t)plainPinTurnOff,
|
||||
output
|
||||
{ plainPinTurnOff, output }
|
||||
PASS_ENGINE_PARAMETER_SUFFIX
|
||||
);
|
||||
}
|
||||
|
@ -105,12 +103,12 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
|||
fixAngle(onTime, "onTime", CUSTOM_ERR_6556);
|
||||
scheduleByAngle(onEvent,
|
||||
onTime,
|
||||
(schfunc_t) &plainPinTurnOn, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
&plainPinTurnOn, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t offTime = extra + engine->engineState.auxValveEnd;
|
||||
fixAngle(offTime, "offTime", CUSTOM_ERR_6557);
|
||||
scheduleByAngle(offEvent,
|
||||
offTime,
|
||||
(schfunc_t) &plainPinTurnOff, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
&plainPinTurnOff, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
if (isOverlap) {
|
||||
enginePins.debugTriggerSync.setValue(0);
|
||||
}
|
||||
|
@ -151,8 +149,7 @@ void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
scheduleOrQueue(&actor->open,
|
||||
TRIGGER_EVENT_UNDEFINED,
|
||||
actor->extra + engine->engineState.auxValveStart,
|
||||
(schfunc_t)plainPinTurnOn,
|
||||
actor
|
||||
{ plainPinTurnOn, actor }
|
||||
PASS_ENGINE_PARAMETER_SUFFIX
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file aux_valves.h
|
||||
*
|
||||
* @date Nov 25, 2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* See http://rusefi.com/docs/html/
|
||||
*
|
||||
* @date Feb 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
@ -186,17 +186,17 @@ void seTurnPinLow(InjectionEvent *event) {
|
|||
ENGINE(injectionEvents.addFuelEventsForCylinder(event->ownIndex PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
}
|
||||
|
||||
static void sescheduleByTimestamp(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, InjectionEvent *event DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
static void sescheduleByTimestamp(scheduling_s *scheduling, efitimeus_t time, action_s action DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if FUEL_MATH_EXTREME_LOGGING
|
||||
InjectorOutputPin *param = event->outputs[0];
|
||||
// scheduleMsg(&sharedLogger, "schX %s %x %d", prefix, scheduling, time);
|
||||
// scheduleMsg(&sharedLogger, "schX %s", param->name);
|
||||
|
||||
const char *direction = callback == (schfunc_t) &seTurnPinHigh ? "up" : "down";
|
||||
const char *direction = callback == &seTurnPinHigh ? "up" : "down";
|
||||
printf("seScheduleByTime %s %s %d sch=%d\r\n", direction, param->name, (int)time, (int)scheduling);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING || EFI_UNIT_TEST */
|
||||
|
||||
engine->executor.scheduleByTimestamp(scheduling, time, callback, event);
|
||||
engine->executor.scheduleByTimestamp(scheduling, time, action);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event,
|
||||
|
@ -278,9 +278,9 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
|||
// todo: sequential need this logic as well, just do not forget to clear flag event->isScheduled = true;
|
||||
scheduling_s * sDown = &event->endOfInjectionEvent;
|
||||
|
||||
engine->executor.scheduleForLater(sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, engine);
|
||||
engine->executor.scheduleForLater(sUp, (int) injectionStartDelayUs, { &startSimultaniousInjection, engine });
|
||||
engine->executor.scheduleForLater(sDown, (int) injectionStartDelayUs + durationUs,
|
||||
(schfunc_t) &endSimultaniousInjection, event);
|
||||
{ &endSimultaniousInjection, event });
|
||||
|
||||
} else {
|
||||
#if EFI_UNIT_TEST
|
||||
|
@ -327,10 +327,10 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
|||
printf("please cancel %s %d %d\r\n", output->name, (int)getTimeNowUs(), output->overlappingCounter);
|
||||
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
||||
} else {
|
||||
sescheduleByTimestamp(sUp, turnOnTime, (schfunc_t) &seTurnPinHigh, event PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
sescheduleByTimestamp(sUp, turnOnTime, { &seTurnPinHigh, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
efitimeus_t turnOffTime = nowUs + (int) (injectionStartDelayUs + durationUs);
|
||||
sescheduleByTimestamp(sDown, turnOffTime, (schfunc_t) &seTurnPinLow, event PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
sescheduleByTimestamp(sDown, turnOffTime, { &seTurnPinLow, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
|||
* This is the main trigger event handler.
|
||||
* Both injection and ignition are controlled from this method.
|
||||
*/
|
||||
static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
ScopePerf perf(PE::MainTriggerCallback);
|
||||
|
||||
(void) ckpSignalType;
|
||||
|
@ -561,7 +561,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
if (pulseLength > 0) {
|
||||
startSimultaniousInjection(engine);
|
||||
efitimeus_t turnOffDelayUs = (efitimeus_t)efiRound(MS2US(pulseLength), 1.0f);
|
||||
engine->executor.scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine);
|
||||
engine->executor.scheduleForLater(sDown, turnOffDelayUs, { &endSimultaniousInjectionOnlyTogglePins, engine });
|
||||
}
|
||||
}
|
||||
#if EFI_PROD_CODE
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
*
|
||||
* @date Feb 9, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -263,7 +263,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* Shaft Position callback used to schedule start and end of MAP averaging
|
||||
*/
|
||||
static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
|
||||
ScopePerf perf(PE::MapAveragingTriggerCallback);
|
||||
|
||||
|
@ -313,10 +313,10 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
|||
// at the moment we schedule based on time prediction based on current RPM and angle
|
||||
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision
|
||||
// todo: schedule this based on closest trigger event, same as ignition works
|
||||
scheduleByAngle(&startTimer[i][structIndex], samplingStart,
|
||||
startAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(&endTimer[i][structIndex], samplingEnd,
|
||||
endAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(&startTimer[i][structIndex], edgeTimestamp, samplingStart,
|
||||
startAveraging PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(&endTimer[i][structIndex], edgeTimestamp, samplingEnd,
|
||||
endAveraging PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->m.mapAveragingCbTime = getTimeNowLowerNt()
|
||||
- engine->m.beforeMapAveragingCb;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* instant RPM instead of cycle RPM more often.
|
||||
*
|
||||
* @date Jan 1, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "globalaccess.h"
|
||||
|
@ -227,8 +227,7 @@ void RpmCalculator::setSpinningUp(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFI
|
|||
* This callback is invoked on interrupt thread.
|
||||
*/
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
uint32_t index, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
efiAssertVoid(CUSTOM_ERR_6632, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstckRCL");
|
||||
|
||||
RpmCalculator *rpmState = &engine->rpmCalculator;
|
||||
|
@ -313,7 +312,7 @@ static void onTdcCallback(Engine *engine) {
|
|||
* This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
|
||||
*/
|
||||
static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
||||
uint32_t index0 DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
(void) ckpSignalType;
|
||||
bool isTriggerSynchronizationPoint = index0 == 0;
|
||||
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
|
||||
|
@ -322,8 +321,8 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
|||
int rpm = GET_RPM();
|
||||
// todo: use tooth event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
scheduleByAngle(&tdcScheduler[revIndex2], tdcPosition(),
|
||||
(schfunc_t) onTdcCallback, engine PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(&tdcScheduler[revIndex2], edgeTimestamp, tdcPosition(),
|
||||
{ onTdcCallback, engine } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,10 +360,14 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
* The callback would be executed once after the duration of time which
|
||||
* it takes the crankshaft to rotate to the specified angle.
|
||||
*/
|
||||
void scheduleByAngle(scheduling_s *timer, angle_t angle,
|
||||
schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
void scheduleByAngle(scheduling_s *timer, efitick_t edgeTimestamp, angle_t angle,
|
||||
action_s action DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
float delayUs = ENGINE(rpmCalculator.oneDegreeUs) * angle;
|
||||
ENGINE(executor.scheduleForLater(timer, (int) delayUs, callback, param));
|
||||
|
||||
efitime_t delayNt = US2NT(delayUs);
|
||||
efitime_t delayedTime = edgeTimestamp + delayNt;
|
||||
|
||||
ENGINE(executor.scheduleByTimestampNt(timer, delayedTime, action));
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Shaft position sensor(s) decoder header
|
||||
*
|
||||
* @date Jan 1, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -165,5 +165,5 @@ float getCrankshaftAngleNt(efitick_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|||
#define addEngineSnifferEvent(n, msg) {}
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
|
||||
void scheduleByAngle(scheduling_s *timer, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void scheduleByAngle(scheduling_s *timer, efitick_t edgeTimestamp, angle_t angle, action_s action DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file spark_logic.cpp
|
||||
*
|
||||
* @date Sep 15, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "spark_logic.h"
|
||||
|
@ -227,8 +227,8 @@ static bool assertNotInIgnitionList(AngleBasedEvent *head, AngleBasedEvent *elem
|
|||
bool scheduleOrQueue(AngleBasedEvent *event,
|
||||
uint32_t trgEventIndex,
|
||||
angle_t angle,
|
||||
schfunc_t callback,
|
||||
void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
action_s action
|
||||
DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
event->position.setAngle(angle PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
/**
|
||||
|
@ -253,10 +253,10 @@ bool scheduleOrQueue(AngleBasedEvent *event,
|
|||
|
||||
scheduling_s * sDown = &event->scheduling;
|
||||
|
||||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, callback, param);
|
||||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, action);
|
||||
return true;
|
||||
} else {
|
||||
event->action.setAction(callback, param);
|
||||
event->action = action;
|
||||
/**
|
||||
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
|
||||
*/
|
||||
|
@ -321,7 +321,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
||||
* the coil.
|
||||
*/
|
||||
engine->executor.scheduleForLater(sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent);
|
||||
engine->executor.scheduleForLater(sUp, chargeDelayUs, { &turnSparkPinHigh, iEvent });
|
||||
}
|
||||
/**
|
||||
* Spark event is often happening during a later trigger event timeframe
|
||||
|
@ -332,7 +332,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
assertAngleRange(sparkAngle, "findAngle#a5", CUSTOM_ERR_6549);
|
||||
|
||||
|
||||
bool scheduled = scheduleOrQueue(&iEvent->sparkEvent, trgEventIndex, sparkAngle, (schfunc_t)fireSparkAndPrepareNextSchedule, iEvent PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
bool scheduled = scheduleOrQueue(&iEvent->sparkEvent, trgEventIndex, sparkAngle, { fireSparkAndPrepareNextSchedule, iEvent } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
if (scheduled) {
|
||||
#if SPARK_EXTREME_LOGGING
|
||||
|
@ -425,7 +425,7 @@ static void scheduleAllSparkEventsUntilNextTriggerTooth(uint32_t trgEventIndex D
|
|||
|
||||
|
||||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->position.angleOffsetFromTriggerEvent;
|
||||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) current->action.getCallback(), current->action.getArgument());
|
||||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, current->action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file spark_logic.h
|
||||
*
|
||||
* @date Sep 15, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -24,5 +24,5 @@ int isIgnitionTimingError(void);
|
|||
bool scheduleOrQueue(AngleBasedEvent *event,
|
||||
uint32_t trgEventIndex,
|
||||
angle_t angle,
|
||||
schfunc_t callback,
|
||||
void *param DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
action_s action
|
||||
DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file lcd_controller.h
|
||||
*
|
||||
* @date Aug 14, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -19,12 +19,12 @@ EXTERN_ENGINE;
|
|||
|
||||
static scheduling_s tachTurnSignalOff;
|
||||
|
||||
static void turnTachPinLow(void) {
|
||||
static void turnTachPinLow(void *) {
|
||||
enginePins.tachOut.setLow();
|
||||
}
|
||||
|
||||
static void tachSignalCallback(trigger_event_e ckpSignalType,
|
||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
UNUSED(ckpSignalType);
|
||||
if (index != (uint32_t)engineConfiguration->tachPulseTriggerIndex) {
|
||||
return;
|
||||
|
@ -37,7 +37,7 @@ static void tachSignalCallback(trigger_event_e ckpSignalType,
|
|||
} else {
|
||||
durationMs = engineConfiguration->tachPulseDuractionMs;
|
||||
}
|
||||
engine->executor.scheduleForLater(&tachTurnSignalOff, (int)MS2US(durationMs), (schfunc_t) &turnTachPinLow, NULL);
|
||||
engine->executor.scheduleForLater(&tachTurnSignalOff, (int)MS2US(durationMs), &turnTachPinLow);
|
||||
}
|
||||
|
||||
void initTachometer(void) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Dec 14 16:03:19 EST 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Dec 30 01:37:14 EST 2019
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
|
||||
|
@ -2052,7 +2052,11 @@ struct engine_configuration_s {
|
|||
/**
|
||||
* offset 1772
|
||||
*/
|
||||
uint8_t unusedFormerWarmupAfrPid[4];
|
||||
uint8_t unusedFormerWarmupAfrPid[3];
|
||||
/**
|
||||
* offset 1775
|
||||
*/
|
||||
uint8_t tachPulsePerRev;
|
||||
/**
|
||||
* kPa value which is too low to be true
|
||||
* offset 1776
|
||||
|
@ -3108,4 +3112,4 @@ typedef struct persistent_config_s persistent_config_s;
|
|||
|
||||
#endif
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Dec 14 16:03:19 EST 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Dec 30 01:37:14 EST 2019
|
||||
|
|
|
@ -1726,6 +1726,8 @@
|
|||
#define tachPulseDuractionMs_offset_hex 6a8
|
||||
#define tachPulseDurationAsDutyCycle_offset 1464
|
||||
#define tachPulseDurationAsDutyCycle_offset_hex 5b8
|
||||
#define tachPulsePerRev_offset 1775
|
||||
#define tachPulsePerRev_offset_hex 6ef
|
||||
#define tachPulseTriggerIndex_offset 1708
|
||||
#define tachPulseTriggerIndex_offset_hex 6ac
|
||||
#define targetVBatt_offset 2024
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* See also common_headers.h
|
||||
*
|
||||
* Dec 25, 2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* todo: rename this file
|
||||
*
|
||||
* @date Sep 8, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file config_engine_specs.h
|
||||
*
|
||||
* @date Jan 28, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file speed_density.h
|
||||
*
|
||||
* @date May 29, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* @file maf2map.cpp
|
||||
*
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
* @date Jan 20, 2018
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* @file maf2map.h
|
||||
*
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
* @date Jan 20, 2018
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
#include "engine.h"
|
||||
#include "tps.h"
|
||||
|
|
|
@ -82,8 +82,11 @@ void printFloatArray(const char *prefix, float array[], int size) {
|
|||
}
|
||||
|
||||
void printSpiState(Logging *logger, const engine_configuration_s *engineConfiguration) {
|
||||
scheduleMsg(logger, "spi 1=%s/2=%s/3=%s", boolToString(engineConfiguration->is_enabled_spi_1),
|
||||
boolToString(engineConfiguration->is_enabled_spi_2), boolToString(engineConfiguration->is_enabled_spi_3));
|
||||
scheduleMsg(logger, "spi 1=%s/2=%s/3=%s/4=%s",
|
||||
boolToString(engineConfiguration->is_enabled_spi_1),
|
||||
boolToString(engineConfiguration->is_enabled_spi_2),
|
||||
boolToString(engineConfiguration->is_enabled_spi_3),
|
||||
boolToString(engineConfiguration->is_enabled_spi_4));
|
||||
}
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* @file dc_motor.h
|
||||
*
|
||||
* ETB user documentation at https://github.com/rusefi/rusefi_documentation/wiki/HOWTO_electronic_throttle_body
|
||||
*
|
||||
*
|
||||
* @date Dec 22, 2018
|
||||
* @author Matthew Kennedy, (c) 2018
|
||||
*/
|
||||
|
@ -35,13 +38,8 @@ public:
|
|||
class SimplePwm;
|
||||
|
||||
/**
|
||||
* @brief Represents a DC motor controller (H bridge) with one pin for enable (PWM),
|
||||
* and two pins for direction control.
|
||||
*
|
||||
* The enable pin is used for PWM and disable, and the two direction pins are used
|
||||
* to set the polarity of each half of the H bridge. setting {dir1,dir2} = 10 should,
|
||||
* turn the motor one direction (positive duty), and = 01 should turn the other way (negative
|
||||
* duty).
|
||||
* @brief Represents a DC motor controller (H-bridge) with some combination of PWM and on/off control pins.
|
||||
*
|
||||
*/
|
||||
class TwoPinDcMotor : public DcMotor
|
||||
{
|
||||
|
@ -54,6 +52,11 @@ public:
|
|||
*/
|
||||
PwmDirectionPins,
|
||||
/**
|
||||
* The control/enable pin is used for PWM and disable, and the two direction pins are used
|
||||
* to set the polarity of each half of the H bridge. setting {dir1,dir2} = 10 should,
|
||||
* turn the motor one direction (positive duty), and = 01 should turn the other way (negative
|
||||
* duty).
|
||||
*
|
||||
* For example VNH2SP30 - three control wires:
|
||||
* PWM on 'enable' PIN, two binary pins for direction
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
*
|
||||
* @date Sep 26, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file periodic_task.cpp
|
||||
*
|
||||
* @date: Jul 8, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "periodic_task.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file periodic_task.h
|
||||
*
|
||||
* @date Jul 8, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -36,13 +36,13 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) {
|
|||
/**
|
||||
* @return true if inserted into the head of the list
|
||||
*/
|
||||
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
||||
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, action_s action) {
|
||||
ScopePerf perf(PE::EventQueueInsertTask);
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
assertListIsSorted();
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
efiAssert(CUSTOM_ERR_ASSERT, callback != NULL, "NULL callback", false);
|
||||
efiAssert(CUSTOM_ERR_ASSERT, action.getCallback() != NULL, "NULL callback", false);
|
||||
|
||||
// please note that simulator does not use this code at all - simulator uses signal_executor_sleep
|
||||
|
||||
|
@ -57,7 +57,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
|||
}
|
||||
|
||||
scheduling->momentX = timeX;
|
||||
scheduling->action.setAction(callback, param);
|
||||
scheduling->action = action;
|
||||
scheduling->isScheduled = true;
|
||||
|
||||
if (head == NULL || timeX < head->momentX) {
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
/**
|
||||
* O(size) - linear search in sorted linked list
|
||||
*/
|
||||
bool insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param);
|
||||
bool insertTask(scheduling_s *scheduling, efitime_t timeX, action_s action);
|
||||
|
||||
int executeAll(efitime_t now);
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ static void timerCallback(PwmConfig *state) {
|
|||
return;
|
||||
}
|
||||
|
||||
state->executor->scheduleByTimestamp(&state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state);
|
||||
state->executor->scheduleByTimestamp(&state->scheduling, switchTimeUs, { timerCallback, state });
|
||||
state->dbgNestingLevel--;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file scheduler.h
|
||||
*
|
||||
* @date May 18, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
@ -12,7 +12,17 @@ typedef void (*schfunc_t)(void *);
|
|||
|
||||
class action_s {
|
||||
public:
|
||||
void setAction(schfunc_t callback, void *param);
|
||||
action_s() = default;
|
||||
|
||||
// Allow implicit conversion from schfunc_t to action_s
|
||||
action_s(schfunc_t callback) : action_s(callback, nullptr) { }
|
||||
action_s(schfunc_t callback, void *param) : callback(callback), param(param) { }
|
||||
|
||||
// Allow any function that takes a single pointer parameter, so long as param is also of the same pointer type.
|
||||
// This constructor means you shouldn't ever have to cast to schfunc_t on your own.
|
||||
template <typename TArg>
|
||||
action_s(void (*callback)(TArg*), TArg* param) : callback((schfunc_t)callback), param(param) { }
|
||||
|
||||
void execute();
|
||||
schfunc_t getCallback() const;
|
||||
void * getArgument() const;
|
||||
|
@ -25,8 +35,7 @@ private:
|
|||
/**
|
||||
* This structure holds information about an event scheduled in the future: when to execute what callback with what parameters
|
||||
*/
|
||||
class scheduling_s {
|
||||
public:
|
||||
struct scheduling_s {
|
||||
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||
virtual_timer_t timer;
|
||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||
|
@ -45,11 +54,11 @@ public:
|
|||
action_s action;
|
||||
};
|
||||
|
||||
class ExecutorInterface {
|
||||
public:
|
||||
struct ExecutorInterface {
|
||||
/**
|
||||
* see also scheduleByAngle
|
||||
*/
|
||||
virtual void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) = 0;
|
||||
virtual void scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) = 0;
|
||||
virtual void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) = 0;
|
||||
virtual void scheduleByTimestampNt(scheduling_s *scheduling, efitime_t timeUs, action_s action) = 0;
|
||||
virtual void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) = 0;
|
||||
};
|
||||
|
|
|
@ -33,8 +33,12 @@
|
|||
|
||||
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||
|
||||
void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
|
||||
scheduleForLater(scheduling, timeUs - getTimeNowUs(), callback, param);
|
||||
void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||
scheduleForLater(scheduling, timeUs - getTimeNowUs(), action);
|
||||
}
|
||||
|
||||
void SleepExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||
scheduleByTimestamp(scheduling, NT2US(timeNt), action);
|
||||
}
|
||||
|
||||
static void timerCallback(scheduling_s *scheduling) {
|
||||
|
@ -50,18 +54,18 @@ static void timerCallback(scheduling_s *scheduling) {
|
|||
scheduling->action.execute();
|
||||
}
|
||||
|
||||
static void doScheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||
static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
||||
int delaySt = MY_US2ST(delayUs);
|
||||
if (delaySt <= 0) {
|
||||
/**
|
||||
* in case of zero delay, we should invoke the callback
|
||||
*/
|
||||
callback(param);
|
||||
action.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
bool alreadyLocked = lockAnyContext();
|
||||
scheduling->action.setAction(callback, param);
|
||||
scheduling->action = action;
|
||||
int isArmed = chVTIsArmedI(&scheduling->timer);
|
||||
if (isArmed) {
|
||||
/**
|
||||
|
@ -71,8 +75,8 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t
|
|||
}
|
||||
|
||||
#if EFI_SIMULATOR
|
||||
if (callback == (schfunc_t)&seTurnPinLow) {
|
||||
printf("setTime cb=seTurnPinLow p=%d\r\n", (int)param);
|
||||
if (action.getCallback() == (schfunc_t)&seTurnPinLow) {
|
||||
printf("setTime cb=seTurnPinLow p=%d\r\n", (int)action.getArgument());
|
||||
} else {
|
||||
// printf("setTime cb=%d p=%d\r\n", (int)callback, (int)param);
|
||||
}
|
||||
|
@ -84,8 +88,8 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t
|
|||
}
|
||||
}
|
||||
|
||||
void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||
doScheduleForLater(scheduling, delayUs, callback, param);
|
||||
void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
||||
doScheduleForLater(scheduling, delayUs, action);
|
||||
}
|
||||
|
||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
class SleepExecutor : public ExecutorInterface {
|
||||
public:
|
||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) override;
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) override;
|
||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
||||
void scheduleByTimestampNt(scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
||||
};
|
||||
|
||||
#endif /* SIGNAL_EXECUTOR_SLEEP_H_ */
|
||||
|
|
|
@ -66,8 +66,8 @@ SingleTimerExecutor::SingleTimerExecutor() {
|
|||
queue.setLateDelay(US2NT(100));
|
||||
}
|
||||
|
||||
void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||
void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,8 +80,11 @@ void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs
|
|||
* @param [in] delayUs the number of microseconds before the output signal immediate output if delay is zero.
|
||||
* @param [in] dwell the number of ticks of output duration.
|
||||
*/
|
||||
void SingleTimerExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback,
|
||||
void *param) {
|
||||
void SingleTimerExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||
scheduleByTimestampNt(scheduling, US2NT(timeUs), action);
|
||||
}
|
||||
|
||||
void SingleTimerExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitime_t nt, action_s action) {
|
||||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||
|
||||
scheduleCounter++;
|
||||
|
@ -90,7 +93,7 @@ void SingleTimerExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeu
|
|||
// this would guard the queue and disable interrupts
|
||||
alreadyLocked = lockAnyContext();
|
||||
}
|
||||
bool needToResetTimer = queue.insertTask(scheduling, US2NT(timeUs), callback, param);
|
||||
bool needToResetTimer = queue.insertTask(scheduling, nt, action);
|
||||
if (!reentrantFlag) {
|
||||
doExecute();
|
||||
if (needToResetTimer) {
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
class SingleTimerExecutor : public ExecutorInterface {
|
||||
public:
|
||||
SingleTimerExecutor();
|
||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) override;
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) override;
|
||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
||||
void scheduleByTimestampNt(scheduling_s *scheduling, efitime_t timeNt, action_s action) override;
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
||||
void onTimerCallback();
|
||||
int timerCallbackCounter;
|
||||
int scheduleCounter;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file trigger_structure.h
|
||||
*
|
||||
* @date Dec 22, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Here we have a bunch of higher-level methods which are not directly related to actual signal decoding
|
||||
*
|
||||
* @date Feb 23, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
@ -84,7 +84,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E
|
|||
engine->triggerCentral.addEventListener(listener, name, engine);
|
||||
}
|
||||
|
||||
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
TriggerCentral *tc = &engine->triggerCentral;
|
||||
if (front == TV_RISE) {
|
||||
tc->vvtEventRiseCounter++;
|
||||
|
@ -108,8 +108,6 @@ void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX)
|
|||
|
||||
tc->vvtCamCounter++;
|
||||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
|
||||
if (engineConfiguration->vvtMode == MIATA_NB2) {
|
||||
uint32_t currentDuration = nowNt - tc->previousVvtCamTime;
|
||||
float ratio = ((float) currentDuration) / tc->previousVvtCamDuration;
|
||||
|
@ -193,7 +191,7 @@ uint32_t triggerMaxDuration = 0;
|
|||
static bool isInsideTriggerHandler = false;
|
||||
|
||||
|
||||
void hwHandleShaftSignal(trigger_event_e signal) {
|
||||
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
|
||||
ScopePerf perf(PE::HandleShaftSignal, static_cast<uint8_t>(signal));
|
||||
|
||||
#if EFI_TOOTH_LOGGER
|
||||
|
@ -216,7 +214,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
|
|||
maxTriggerReentraint = triggerReentraint;
|
||||
triggerReentraint++;
|
||||
efiAssertVoid(CUSTOM_ERR_6636, getCurrentRemainingStack() > 128, "lowstck#8");
|
||||
engine->triggerCentral.handleShaftSignal(signal PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->triggerCentral.handleShaftSignal(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
triggerReentraint--;
|
||||
triggerDuration = getTimeNowLowerNt() - triggerHandlerEntryTime;
|
||||
isInsideTriggerHandler = false;
|
||||
|
@ -314,7 +312,7 @@ bool TriggerCentral::noiseFilter(efitick_t nowNt, trigger_event_e signal DECLARE
|
|||
return false;
|
||||
}
|
||||
|
||||
void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
efiAssertVoid(CUSTOM_CONF_NULL, engine!=NULL, "configuration");
|
||||
|
||||
if (triggerShape.shapeDefinitionError) {
|
||||
|
@ -325,11 +323,9 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
return;
|
||||
}
|
||||
|
||||
nowNt = getTimeNowNt();
|
||||
|
||||
// This code gathers some statistics on signals and compares accumulated periods to filter interference
|
||||
if (CONFIG(useNoiselessTriggerDecoder)) {
|
||||
if (!noiseFilter(nowNt, signal PASS_ENGINE_PARAMETER_SUFFIX)) {
|
||||
if (!noiseFilter(timestamp, signal PASS_ENGINE_PARAMETER_SUFFIX)) {
|
||||
return;
|
||||
}
|
||||
// moved here from hwHandleShaftSignal()
|
||||
|
@ -338,25 +334,25 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
}
|
||||
}
|
||||
|
||||
engine->onTriggerSignalEvent(nowNt);
|
||||
engine->onTriggerSignalEvent(timestamp);
|
||||
|
||||
int eventIndex = (int) signal;
|
||||
efiAssertVoid(CUSTOM_ERR_6638, eventIndex >= 0 && eventIndex < HW_EVENT_TYPES, "signal type");
|
||||
hwEventCounters[eventIndex]++;
|
||||
|
||||
if (nowNt - previousShaftEventTimeNt > US2NT(US_PER_SECOND_LL)) {
|
||||
if (timestamp - previousShaftEventTimeNt > US2NT(US_PER_SECOND_LL)) {
|
||||
/**
|
||||
* We are here if there is a time gap between now and previous shaft event - that means the engine is not runnig.
|
||||
* We are here if there is a time gap between now and previous shaft event - that means the engine is not running.
|
||||
* That means we have lost synchronization since the engine is not running :)
|
||||
*/
|
||||
triggerState.onSynchronizationLost(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
previousShaftEventTimeNt = nowNt;
|
||||
previousShaftEventTimeNt = timestamp;
|
||||
|
||||
/**
|
||||
* This invocation changes the state of triggerState
|
||||
*/
|
||||
triggerState.decodeTriggerEvent(nullptr, engine, signal, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
triggerState.decodeTriggerEvent(nullptr, engine, signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
/**
|
||||
* If we only have a crank position sensor with four stroke, here we are extending crank revolutions with a 360 degree
|
||||
|
@ -376,7 +372,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
triggerIndexForListeners = triggerState.getCurrentIndex() + (crankInternalIndex * getTriggerSize());
|
||||
}
|
||||
if (triggerIndexForListeners == 0) {
|
||||
timeAtVirtualZeroNt = nowNt;
|
||||
timeAtVirtualZeroNt = timestamp;
|
||||
}
|
||||
reportEventToWaveChart(signal, triggerIndexForListeners PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
@ -397,7 +393,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
*/
|
||||
for (int i = 0; i < triggerListeneres.currentListenersCount; i++) {
|
||||
ShaftPositionListener listener = (ShaftPositionListener) (void*) triggerListeneres.callbacks[i];
|
||||
(listener)(signal, triggerIndexForListeners PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
(listener)(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file trigger_central.h
|
||||
*
|
||||
* @date Feb 23, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -13,7 +13,7 @@
|
|||
#include "trigger_central_generated.h"
|
||||
|
||||
class Engine;
|
||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
#define HAVE_CAM_INPUT() engineConfiguration->camInputs[0] != GPIO_UNASSIGNED
|
||||
|
||||
|
@ -26,14 +26,14 @@ class TriggerCentral : public trigger_central_s {
|
|||
public:
|
||||
TriggerCentral();
|
||||
void addEventListener(ShaftPositionListener handler, const char *name, Engine *engine);
|
||||
void handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
int getHwEventCounter(int index) const;
|
||||
void resetCounters();
|
||||
void resetAccumSignalData();
|
||||
bool noiseFilter(efitick_t nowNt, trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void validateCamVvtCounters();
|
||||
TriggerStateWithRunningStatistics triggerState;
|
||||
efitick_t nowNt = 0;
|
||||
|
||||
angle_t vvtPosition = 0;
|
||||
/**
|
||||
* this is similar to TriggerState#startOfCycleNt but with the crank-only sensor magic
|
||||
|
@ -56,8 +56,8 @@ private:
|
|||
};
|
||||
|
||||
void triggerInfo(void);
|
||||
void hwHandleShaftSignal(trigger_event_e signal);
|
||||
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp);
|
||||
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
void initTriggerCentral(Logging *sharedLogger);
|
||||
void printAllTriggers();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file trigger_decoder.cpp
|
||||
*
|
||||
* @date Dec 24, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file trigger_decoder.h
|
||||
*
|
||||
* @date Dec 24, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -45,22 +45,24 @@ EXTERN_ENGINE
|
|||
;
|
||||
|
||||
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex) {
|
||||
efitick_t stamp = getTimeNowNt();
|
||||
|
||||
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
|
||||
MultiChannelStateSequence *multiChannelStateSequence = &state->multiChannelStateSequence;
|
||||
|
||||
if (needEvent(stateIndex, state->phaseCount, &state->multiChannelStateSequence, 0)) {
|
||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/0, stateIndex);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING, stamp);
|
||||
}
|
||||
|
||||
if (needEvent(stateIndex, state->phaseCount, &state->multiChannelStateSequence, 1)) {
|
||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/1, stateIndex);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING, stamp);
|
||||
}
|
||||
|
||||
if (needEvent(stateIndex, state->phaseCount, &state->multiChannelStateSequence, 2)) {
|
||||
pin_state_t currentValue = multiChannelStateSequence->getChannelState(/*phaseIndex*/2, stateIndex);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING);
|
||||
hwHandleShaftSignal(currentValue ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING, stamp);
|
||||
}
|
||||
|
||||
// print("hello %d\r\n", chTimeNow());
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief This class knows how to produce synthetic shaft signals based on triggerShape
|
||||
*
|
||||
* @date Sep 23, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Both external events (see logic_analyzer.cpp) and internal (see signal executors) are supported
|
||||
*
|
||||
* @date Jun 23, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* this is rusEfi build-in logic analyzer
|
||||
*
|
||||
* @date Jan 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "logic_analyzer.h"
|
||||
|
@ -128,12 +128,13 @@ WaveReader::WaveReader() {
|
|||
hw = nullptr;
|
||||
}
|
||||
|
||||
static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
(void)ckpSignalType;
|
||||
if (index != 0) {
|
||||
return;
|
||||
}
|
||||
efitimeus_t nowUs = getTimeNowUs();
|
||||
|
||||
efitimeus_t nowUs = NT2US(edgeTimestamp);
|
||||
engineCycleDurationUs = nowUs - previousEngineCycleTimeUs;
|
||||
previousEngineCycleTimeUs = nowUs;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file logic_analyzer.h
|
||||
*
|
||||
* @date Jan 7, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file sensor_chart.h
|
||||
*
|
||||
* @date Dec 20, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
#TS_PATH="/home/<user>/TunerStudioProjects/"
|
||||
|
||||
echo "This batch files reads rusefi_config.txt and produses firmware persistent configuration headers"
|
||||
echo "the storage section of rusefi.ini is updated as well"
|
||||
|
||||
rm gen_config.log
|
||||
rm gen_config_board.log
|
||||
|
||||
echo "lazy is broken - TS input is not considered a change"
|
||||
rm build/config.gen
|
||||
|
||||
mkdir build
|
||||
|
||||
java -DSystemOut.name=gen_config \
|
||||
-Drusefi.generator.lazyfile.enabled=true \
|
||||
-jar ../java_tools/ConfigDefinition.jar \
|
||||
-definition integration/rusefi_config.txt \
|
||||
-romraider integration \
|
||||
-ts_destination tunerstudio \
|
||||
-with_c_defines false \
|
||||
-initialize_to_zero false \
|
||||
-c_defines controllers/generated/rusefi_generated.h \
|
||||
-c_destination controllers/generated/engine_configuration_generated_structures.h \
|
||||
-c_fsio_constants controllers/generated/fsio_enums_generated.def \
|
||||
-c_fsio_getters controllers/generated/fsio_getters.def \
|
||||
-c_fsio_names controllers/generated/fsio_names.def \
|
||||
-c_fsio_strings controllers/generated/fsio_strings.def \
|
||||
-java_destination ../java_console/models/src/com/rusefi/config/generated/Fields.java \
|
||||
-romraider_destination ../java_console/rusefi.xml \
|
||||
-skip build/config.gen
|
||||
|
||||
[ $? -eq 0 ] || (echo "ERROR generating"; exit $?)
|
||||
|
||||
if [ -z "${TS_PATH}" ]; then
|
||||
echo "TS_PATH not defined"
|
||||
else
|
||||
echo "This would automatically copy latest file to 'dev' TS project at ${TS_PATH}"
|
||||
cp -v tunerstudio/rusefi.ini $TS_PATH/dev/projectCfg/mainController.ini
|
||||
cp -v tunerstudio/rusefi_microrusefi.ini $TS_PATH/dev_mre/projectCfg/mainController.ini
|
||||
fi
|
||||
|
||||
./gen_config_board.sh microrusefi
|
||||
[ $? -eq 0 ] || (echo "ERROR generating microrusefi"; exit $?)
|
||||
|
||||
./gen_config_board.sh frankenso
|
||||
[ $? -eq 0 ] || (echo "ERROR generating frankenso"; exit $?)
|
||||
|
||||
./gen_config_board.sh prometheus
|
||||
[ $? -eq 0 ] || (echo "ERROR generating prometheus"; exit $?)
|
||||
|
||||
#cd config\boards\kinetis\config
|
||||
#!gen_config.bat
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
echo "This batch files reads rusefi_config.txt and produses firmware persistent configuration headers"
|
||||
echo "the storage section of rusefi.ini is updated as well"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Board name parameter expected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BOARDNAME=$1
|
||||
|
||||
echo "BOARDNAME=${BOARDNAME}"
|
||||
|
||||
echo lazy is broken - TS input is not considered a change
|
||||
rm build/config.gen
|
||||
|
||||
java -DSystemOut.name=gen_config_board \
|
||||
-cp ../java_tools/ConfigDefinition.jar:../java_tools/configuration_definition/lib/snakeyaml.jar \
|
||||
com.rusefi.board_generator.BoardReader \
|
||||
-board ${BOARDNAME} \
|
||||
-firmware_path . \
|
||||
-out tunerstudio \
|
||||
-enumInputFile controllers/algo/rusefi_enums.h \
|
||||
-enumInputFile controllers/algo/rusefi_hw_enums.h
|
||||
|
||||
[ $? -eq 0 ] || (echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit $?)
|
||||
|
||||
java -DSystemOut.name=gen_config_board \
|
||||
-jar ../java_tools/ConfigDefinition.jar \
|
||||
-definition integration/rusefi_config.txt \
|
||||
-ts_destination tunerstudio \
|
||||
-ts_output_name rusefi_${BOARDNAME}.ini \
|
||||
-prepend tunerstudio/${BOARDNAME}_prefix.txt \
|
||||
-prepend config/boards/${BOARDNAME}/prepend.txt \
|
||||
-skip build/config.gen
|
||||
|
||||
[ $? -eq 0 ] || (echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit $?)
|
||||
|
||||
if [ -z "${TS_PATH}" ]; then
|
||||
echo "TS_PATH not defined"
|
||||
else
|
||||
if [ -d "${TS_PATH}/dev_${BOARDNAME}/" ]; then
|
||||
echo "This would automatically copy latest file to 'dev_${BOARDNAME}' TS project $TS_PATH"
|
||||
cp -v tunerstudio/rusefi_microrusefi.ini ${TS_PATH}/dev_${BOARDNAME}/projectCfg/mainController.ini
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,10 @@
|
|||
echo "This batch files reads rusefi_enums.h and produses auto_generated_enums.* files"
|
||||
|
||||
rm gen_enum_to_string.log
|
||||
|
||||
java -DSystemOut.name=gen_enum_to_string \
|
||||
-jar ../java_tools/enum2string.jar \
|
||||
-inputPath . \
|
||||
-outputPath controllers/algo \
|
||||
-enumInputFile controllers/algo/rusefi_enums.h \
|
||||
-enumInputFile controllers/algo/rusefi_hw_enums.h \
|
|
@ -6,7 +6,7 @@
|
|||
* unit_tests have a more meaningful version of this header
|
||||
*
|
||||
* @date Jan 28, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @brief Low level internal ADC code
|
||||
*
|
||||
* @date Jan 14, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef ADC_INPUTS_H_
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file can_hw.h
|
||||
*
|
||||
* @date Dec 11, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* See https://github.com/rusefi/rusefi_documentation/tree/master/misc/Saab_Trionic_8_Combustion%20Detection%20Module_on_Mazda_Miata_running_rusEfi
|
||||
*
|
||||
* Created on: Dec 31, 2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "cdm_ion_sense.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file cdm_ion_sense.h
|
||||
*
|
||||
* @date Dec 31, 2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef HW_LAYER_CDM_ION_SENSE_H_
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue