auto-sync

This commit is contained in:
rusEfi 2014-12-10 23:03:15 -06:00
parent bc15cf88c7
commit 83b80e2fe9
4 changed files with 27 additions and 25 deletions

View File

@ -81,7 +81,7 @@
#define EFI_DENSO_ADC FALSE #define EFI_DENSO_ADC FALSE
#define EFI_CAN_SUPPORT FALSE #define EFI_CAN_SUPPORT TRUE
#define EFI_HD44780_LCD TRUE #define EFI_HD44780_LCD TRUE

View File

@ -480,6 +480,7 @@ typedef struct {
bool_t hasAfrSensor : 1; // bit 2 bool_t hasAfrSensor : 1; // bit 2
bool_t useConstantDwellDuringCranking : 1; // bit 3 bool_t useConstantDwellDuringCranking : 1; // bit 3
bool_t isDigitalChartEnabled : 1; // bit 4 bool_t isDigitalChartEnabled : 1; // bit 4
bool_t isCanEnabled : 1; // bit 5
// that's the next 32 bit field // that's the next 32 bit field
int hasCltSensor; int hasCltSensor;

View File

@ -19,7 +19,8 @@
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__) #if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
EXTERN_ENGINE; EXTERN_ENGINE
;
static int canReadCounter = 0; static int canReadCounter = 0;
static Logging logger; static Logging logger;
@ -42,8 +43,7 @@ extern board_configuration_s *board_configuration;
*/ */
static const CANConfig canConfig = { static const CANConfig canConfig = {
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
CAN_BTR_SJW(0) | CAN_BTR_TS2(1) | CAN_BTR_SJW(0) | CAN_BTR_TS2(1) | CAN_BTR_TS1(8) | CAN_BTR_BRP(6) };
CAN_BTR_TS1(8) | CAN_BTR_BRP(6) };
static CANRxFrame rxBuffer; static CANRxFrame rxBuffer;
static CANTxFrame txmsg; static CANTxFrame txmsg;
@ -59,9 +59,8 @@ static float engine_clt = 0;
static void printPacket(CANRxFrame *rx) { static void printPacket(CANRxFrame *rx) {
// scheduleMsg(&logger, "CAN FMI %x", rx->FMI); // scheduleMsg(&logger, "CAN FMI %x", rx->FMI);
// scheduleMsg(&logger, "TIME %x", rx->TIME); // scheduleMsg(&logger, "TIME %x", rx->TIME);
scheduleMsg(&logger, "SID %x/%x %x %x %x %x %x %x %x %x", rx->SID, rx->DLC, scheduleMsg(&logger, "SID %x/%x %x %x %x %x %x %x %x %x", rx->SID, rx->DLC, rx->data8[0], rx->data8[1],
rx->data8[0], rx->data8[1], rx->data8[2], rx->data8[3], rx->data8[2], rx->data8[3], rx->data8[4], rx->data8[5], rx->data8[6], rx->data8[7]);
rx->data8[4], rx->data8[5], rx->data8[6], rx->data8[7]);
if (rx->SID == CAN_BMW_E46_CLUSTER_STATUS) { if (rx->SID == CAN_BMW_E46_CLUSTER_STATUS) {
int odometerKm = 10 * (rx->data8[1] << 8) + rx->data8[0]; int odometerKm = 10 * (rx->data8[1] << 8) + rx->data8[0];
@ -164,7 +163,6 @@ static msg_t canThread(void *arg) {
if (engineConfiguration->canReadEnabled) if (engineConfiguration->canReadEnabled)
canRead(); // todo: since this is a blocking operation, do we need a separate thread for 'write'? canRead(); // todo: since this is a blocking operation, do we need a separate thread for 'write'?
chThdSleepMilliseconds(engineConfiguration->can_sleep_period); chThdSleepMilliseconds(engineConfiguration->can_sleep_period);
} }
#if defined __GNUC__ #if defined __GNUC__
@ -175,12 +173,15 @@ static msg_t canThread(void *arg) {
static void canInfo(void) { static void canInfo(void) {
scheduleMsg(&logger, "CAN TX %s", hwPortname(boardConfiguration->canTxPin)); scheduleMsg(&logger, "CAN TX %s", hwPortname(boardConfiguration->canTxPin));
scheduleMsg(&logger, "CAN RX %s", hwPortname(boardConfiguration->canRxPin)); scheduleMsg(&logger, "CAN RX %s", hwPortname(boardConfiguration->canRxPin));
scheduleMsg(&logger, "canReadEnabled=%d canWriteEnabled=%d", engineConfiguration->canReadEnabled, engineConfiguration->canWriteEnabled); scheduleMsg(&logger, "canReadEnabled=%d canWriteEnabled=%d", engineConfiguration->canReadEnabled,
engineConfiguration->canWriteEnabled);
scheduleMsg(&logger, "CAN rx count %d", canReadCounter); scheduleMsg(&logger, "CAN rx count %d", canReadCounter);
} }
void initCan(void) { void initCan(void) {
if (!engineConfiguration->isCanEnabled)
return;
initLogging(&logger, "CAN driver"); initLogging(&logger, "CAN driver");
#if STM32_CAN_USE_CAN2 #if STM32_CAN_USE_CAN2

View File

@ -256,7 +256,7 @@ void firmwareError(const char *fmt, ...) {
} }
} }
static char UNUSED_RAM_SIZE[3000]; static char UNUSED_RAM_SIZE[2000];
static char UNUSED_CCM_SIZE[9000] CCM_OPTIONAL; static char UNUSED_CCM_SIZE[9000] CCM_OPTIONAL;