CONFIG_RESET_SWITCH_PORT flexibility

This commit is contained in:
rusefi 2019-04-06 08:41:37 -04:00
parent 17f073a439
commit 05d3ce22f4
5 changed files with 16 additions and 1 deletions

View File

@ -9,6 +9,7 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
-DEFI_INJECTOR_PIN3=GPIO_UNASSIGNED ^
-DEFI_COMMUNICATION_PIN=GPIOA_2 ^
-DEFI_FATAL_ERROR_PIN=GPIOA_5 ^
-DCONFIG_RESET_SWITCH_PORT=NULL ^
-DEFI_ENABLE_ASSERTS=FALSE ^
-DCH_DBG_THREADS_PROFILING=FALSE
rem set DEBUG_LEVEL_OPT="-O2"

View File

@ -46,7 +46,10 @@
#define CONSOLE_MAX_ACTIONS 32
#ifndef CONFIG_RESET_SWITCH_PORT
#define CONFIG_RESET_SWITCH_PORT GPIOD
#endif
#define CONFIG_RESET_SWITCH_PIN 6
/**

View File

@ -362,8 +362,13 @@
#define GPS_SERIAL_DEVICE &SD1
#define GPS_SERIAL_SPEED 38400
#ifndef CONFIG_RESET_SWITCH_PORT
#define CONFIG_RESET_SWITCH_PORT GPIOD
#endif
#ifndef CONFIG_RESET_SWITCH_PIN
#define CONFIG_RESET_SWITCH_PIN 6
#endif
/**
* This is the size of the MemoryStream used by chvprintf

View File

@ -24,8 +24,12 @@ typedef void (*CommandHandler)(char *);
#include "efifeatures.h"
#include "datalogging.h"
#ifdef CONFIG_RESET_SWITCH_PORT
// todo: make this pin configurable
#define SHOULD_INGORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
#define SHOULD_INGORE_FLASH() (CONFIG_RESET_SWITCH_PORT != NULL && palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
#else
#define SHOULD_INGORE_FLASH() (false)
#endif
BaseChannel * getConsoleChannel(void);

View File

@ -375,6 +375,8 @@ void initHardware(Logging *l) {
/**
* this call reads configuration from flash memory or sets default configuration
* if flash state does not look right.
*
* interesting fact that we have another read from flash before we get here
*/
if (SHOULD_INGORE_FLASH()) {
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;