more on board ID
This commit is contained in:
parent
5e84dde53e
commit
63f18a852b
|
@ -23,9 +23,12 @@ board_id_t getBoardId() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HW_HELLEN
|
||||
#if defined(HW_HELLEN_SKIP_BOARD_TYPE)
|
||||
return (board_id_t)STATIC_BOARD_ID;
|
||||
#elif HW_HELLEN
|
||||
return (board_id_t)engine->engineState.hellenBoardId;
|
||||
#elif STATIC_BOARD_ID
|
||||
// should STATIC_BOARD_ID simply have priority over hellen board id? what's the use-case of HW_HELLEN with STATIC_BOARD_ID?
|
||||
return (board_id_t)STATIC_BOARD_ID;
|
||||
#else
|
||||
return 0;
|
||||
|
|
|
@ -53,14 +53,17 @@
|
|||
#include "hellen_board_id.h"
|
||||
|
||||
/* We use known standard E24 series resistor values (1%) to find the closest match.
|
||||
The 16 major values should have a guarateed spacing of 15% in a row (1% R tolerance + 10% C tolerance)
|
||||
The 16 major values should have a guaranteed spacing of 15% in a row (1% R tolerance + 10% C tolerance)
|
||||
These should match the values in the gen_board_id script!
|
||||
*/
|
||||
#include "hellen_board_id_resistors.h"
|
||||
|
||||
//#define HELLEN_BOARD_ID_DEBUG
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
// todo: error: this use of "defined" may not be portable [-Werror=expansion-to-defined ?!
|
||||
// huh? #define HELLEN_BOARD_ID_CODE_NEEDED (defined( HELLEN_BOARD_ID_PIN_1) && !defined(HW_HELLEN_SKIP_BOARD_TYPE))
|
||||
|
||||
#if EFI_PROD_CODE && defined( HELLEN_BOARD_ID_PIN_1) && !defined(HW_HELLEN_SKIP_BOARD_TYPE)
|
||||
|
||||
static void hellenBoardIdInputCallback(void *arg, efitick_t nowNt) {
|
||||
UNUSED(arg);
|
||||
|
@ -74,7 +77,7 @@ static void hellenBoardIdInputCallback(void *arg, efitick_t nowNt) {
|
|||
chSemSignalI(&state->boardId_wake); // no need to call chSchRescheduleS() because we're inside the ISR
|
||||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
#endif /* EFI_PROD_CODE && HELLEN_BOARD_ID_CODE_NEEDED */
|
||||
|
||||
// Newton's numerical method (x is R and y is C, or vice-versa)
|
||||
float HellenBoardIdSolver::solve(float Tc1, float Tc2, float x0, float y, float deltaX) {
|
||||
|
@ -173,7 +176,7 @@ float HellenBoardIdFinderBase::calc(float Tc1_us, float Tc2_us, float Rest, floa
|
|||
|
||||
template <size_t NumPins>
|
||||
bool HellenBoardIdFinder<NumPins>::measureChargingTimes(int i, float & Tc1_us, float & Tc2_us) {
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE && defined( HELLEN_BOARD_ID_PIN_1) && !defined(HW_HELLEN_SKIP_BOARD_TYPE)
|
||||
chSemReset(&state.boardId_wake, 0);
|
||||
|
||||
// full charge/discharge time, and also 'timeout' time
|
||||
|
@ -305,7 +308,7 @@ bool HellenBoardIdFinder<NumPins>::measureChargingTimesAveraged(int i, float & T
|
|||
|
||||
int detectHellenBoardId() {
|
||||
int boardId = -1;
|
||||
#ifdef HELLEN_BOARD_ID_PIN_1
|
||||
#if defined( HELLEN_BOARD_ID_PIN_1) && !defined(HW_HELLEN_SKIP_BOARD_TYPE)
|
||||
efiPrintf("Starting Hellen Board ID detection...");
|
||||
efitick_t beginNt = getTimeNowNt();
|
||||
|
||||
|
|
|
@ -915,12 +915,13 @@ end
|
|||
}
|
||||
|
||||
void detectBoardType() {
|
||||
#if HW_HELLEN && !defined(HW_HELLEN_SKIP_BOARD_TYPE)
|
||||
#if HW_HELLEN
|
||||
#if !EFI_UNIT_TEST
|
||||
detectHellenBoardType();
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
#endif //HW_HELLEN
|
||||
// todo: add board ID detection?
|
||||
// see hellen128 which has/had alternative i2c board id?
|
||||
}
|
||||
|
||||
void fuelBenchMode() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 065ed8f653ae31b716bcee3fbc835d61ca5a1121
|
||||
Subproject commit eb55df14ce87c0ed400f47ee754c9843135711d7
|
|
@ -96,8 +96,8 @@
|
|||
*
|
||||
* @section config Persistent Configuration
|
||||
*
|
||||
* Definition of configuration data structure:
|
||||
* integration/rusefi_config.txt
|
||||
* Definition of configuration data structure:
|
||||
* integration/rusefi_config.txt
|
||||
* This file has a lot of information and instructions in its comment header.
|
||||
* Please note that due to TunerStudio protocol it's important to have the total structure size in sync between the firmware and TS .ini file -
|
||||
* just to make sure that this is not forgotten the size of the structure is hard-coded as PAGE_0_SIZE constant. There is always some 'unused' fields added in advance so that
|
||||
|
@ -201,6 +201,7 @@ void runRusEfi() {
|
|||
// Perform hardware initialization that doesn't need configuration
|
||||
initHardwareNoConfig();
|
||||
|
||||
// at the moment that's always hellen board ID
|
||||
detectBoardType();
|
||||
|
||||
#if EFI_ETHERNET
|
||||
|
|
Loading…
Reference in New Issue