auto-sync
This commit is contained in:
parent
b86934dd78
commit
1e90d175f4
|
@ -9,10 +9,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sachs.h"
|
#include "sachs.h"
|
||||||
|
#include "allsensors.h"
|
||||||
|
|
||||||
void setSachs(engine_configuration_s *engineConfiguration) {
|
void setSachs(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->displacement = 0.1; // 100cc
|
engineConfiguration->displacement = 0.1; // 100cc
|
||||||
|
|
||||||
|
engineConfiguration->hasIatSensor = false;
|
||||||
|
engineConfiguration->hasMapSensor = false;
|
||||||
|
engineConfiguration->hasBaroSensor = false;
|
||||||
|
engineConfiguration->hasAfrSensor = false;
|
||||||
|
engineConfiguration->hasCltSensor = false;
|
||||||
|
|
||||||
|
|
||||||
// Frankenstein analog input #1: PA1 adc1
|
// Frankenstein analog input #1: PA1 adc1
|
||||||
// Frankenstein analog input #2: PA3 adc3
|
// Frankenstein analog input #2: PA3 adc3
|
||||||
// Frankenstein analog input #3: PC3 adc13
|
// Frankenstein analog input #3: PC3 adc13
|
||||||
|
@ -26,6 +34,14 @@ void setSachs(engine_configuration_s *engineConfiguration) {
|
||||||
// Frankenstein analog input #11: PC4 adc14
|
// Frankenstein analog input #11: PC4 adc14
|
||||||
// Frankenstein analog input #12: PC5 adc15
|
// Frankenstein analog input #12: PC5 adc15
|
||||||
|
|
||||||
|
engineConfiguration->tpsAdcChannel = EFI_ADC_1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPS 0% 0.9v
|
||||||
|
* TPS 100% 2.34v
|
||||||
|
*/
|
||||||
|
engineConfiguration->tpsMin = convertVoltageTo10bitADC(1.250);
|
||||||
|
engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538);
|
||||||
|
|
||||||
|
|
||||||
// Frankenstein: low side - out #1: PC14
|
// Frankenstein: low side - out #1: PC14
|
||||||
|
|
|
@ -426,10 +426,7 @@ extern engine_pins_s enginePins;
|
||||||
|
|
||||||
static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, &communicationPin, &checkEnginePin };
|
static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, &communicationPin, &checkEnginePin };
|
||||||
|
|
||||||
/**
|
static void initStatisLeds() {
|
||||||
* This method would blink all the LEDs just to test them
|
|
||||||
*/
|
|
||||||
static void initialLedsBlink(void) {
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
outputPinRegister("communication status 1", &communicationPin, LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN);
|
outputPinRegister("communication status 1", &communicationPin, LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
@ -438,7 +435,12 @@ static void initialLedsBlink(void) {
|
||||||
outputPinRegister("warning", &warningPin, LED_WARNING_PORT, LED_WARNING_PIN);
|
outputPinRegister("warning", &warningPin, LED_WARNING_PORT, LED_WARNING_PIN);
|
||||||
outputPinRegister("is running status", &runningPin, LED_RUNNING_STATUS_PORT, LED_RUNNING_STATUS_PIN);
|
outputPinRegister("is running status", &runningPin, LED_RUNNING_STATUS_PORT, LED_RUNNING_STATUS_PIN);
|
||||||
#endif /* EFI_WARNING_LED */
|
#endif /* EFI_WARNING_LED */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method would blink all the LEDs just to test them
|
||||||
|
*/
|
||||||
|
static void initialLedsBlink(void) {
|
||||||
int size = sizeof(leds) / sizeof(leds[0]);
|
int size = sizeof(leds) / sizeof(leds[0]);
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
leds[i]->setValue(1);
|
leds[i]->setValue(1);
|
||||||
|
@ -450,6 +452,9 @@ static void initialLedsBlink(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* this thread has a lower-then-usual stack size so we cannot afford *print* methods here
|
||||||
|
*/
|
||||||
static void blinkingThread(void *arg) {
|
static void blinkingThread(void *arg) {
|
||||||
(void) arg;
|
(void) arg;
|
||||||
chRegSetThreadName("communication blinking");
|
chRegSetThreadName("communication blinking");
|
||||||
|
@ -616,6 +621,7 @@ void startStatusThreads(Engine *engine) {
|
||||||
chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, (tfunc_t) lcdThread, engine);
|
chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, (tfunc_t) lcdThread, engine);
|
||||||
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t) tsStatusThread, engine);
|
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t) tsStatusThread, engine);
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
|
initStatisLeds();
|
||||||
chThdCreateStatic(blinkingStack, sizeof(blinkingStack), NORMALPRIO, (tfunc_t) blinkingThread, NULL);
|
chThdCreateStatic(blinkingStack, sizeof(blinkingStack), NORMALPRIO, (tfunc_t) blinkingThread, NULL);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,6 +275,22 @@ static THD_WORKING_AREA(csThreadStack, UTILITY_THREAD_STACK_SIZE); // declare th
|
||||||
|
|
||||||
#define isOutOfBounds(offset) ((offset<0) || (offset) >= sizeof(engine_configuration_s))
|
#define isOutOfBounds(offset) ((offset<0) || (offset) >= sizeof(engine_configuration_s))
|
||||||
|
|
||||||
|
static void setShort(const int offset, const int value) {
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
|
uint16_t *ptr = (uint16_t *) (&((char *) engine->engineConfiguration)[offset]);
|
||||||
|
*ptr = (uint16_t)value;
|
||||||
|
scheduleMsg(&logger, "setting short @%d to %d", offset, (uint16_t)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getShort(int offset) {
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
|
uint16_t *ptr = (uint16_t *) (&((char *) engine->engineConfiguration)[offset]);
|
||||||
|
uint16_t value = *ptr;
|
||||||
|
scheduleMsg(&logger, "short @%d is %d", offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
static void setInt(const int offset, const int value) {
|
static void setInt(const int offset, const int value) {
|
||||||
if (isOutOfBounds(offset))
|
if (isOutOfBounds(offset))
|
||||||
return;
|
return;
|
||||||
|
@ -409,8 +425,10 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) {
|
||||||
|
|
||||||
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
|
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
|
||||||
addConsoleActionII("set_int", (VoidIntInt) setInt);
|
addConsoleActionII("set_int", (VoidIntInt) setInt);
|
||||||
|
addConsoleActionII("set_short", (VoidIntInt) setShort);
|
||||||
addConsoleActionI("get_float", getFloat);
|
addConsoleActionI("get_float", getFloat);
|
||||||
addConsoleActionI("get_int", getInt);
|
addConsoleActionI("get_int", getInt);
|
||||||
|
addConsoleActionI("get_short", getShort);
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO || defined(__DOXYGEN__)
|
||||||
initFsioImpl(sharedLogger, engine);
|
initFsioImpl(sharedLogger, engine);
|
||||||
|
|
|
@ -156,6 +156,8 @@ const char* getConfigurationName(engine_type_e engineType) {
|
||||||
return "BMWe34";
|
return "BMWe34";
|
||||||
case TEST_ENGINE:
|
case TEST_ENGINE:
|
||||||
return "Test";
|
return "Test";
|
||||||
|
case SACHS:
|
||||||
|
return "SACHS";
|
||||||
default:
|
default:
|
||||||
firmwareError("Unexpected: engineType %d", engineType);
|
firmwareError("Unexpected: engineType %d", engineType);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue