only:setHwQcMode API

This commit is contained in:
rusefillc 2024-09-19 15:17:07 -04:00
parent 31c91dff41
commit ccd3e53fe2
5 changed files with 12 additions and 16 deletions

View File

@ -21,13 +21,14 @@ extern PinRepository pinRepository;
* quite different from bench testing user functionality: QC direct should never be engaged on a real vehicle * quite different from bench testing user functionality: QC direct should never be engaged on a real vehicle
* Once QC direct control mode is activated the only way out is to reboot the unit! * Once QC direct control mode is activated the only way out is to reboot the unit!
*/ */
// that one could be set by rusEFI console static bool qcDirectPinControlMode = false;
bool qcDirectPinControlMode = false;
// todo: how is this flag different from the one above? shall we merge?
/*board public API*/bool withHwQcActivity = false;
bool isHwQcMode() { /*board public API*/bool isHwQcMode() {
return withHwQcActivity || qcDirectPinControlMode; return qcDirectPinControlMode;
}
void setHwQcMode() {
qcDirectPinControlMode = true;
} }
#if EFI_CAN_SUPPORT #if EFI_CAN_SUPPORT
@ -258,16 +259,14 @@ void processCanQcBenchTest(const CANRxFrame& frame) {
if (frame.data8[0] != (int)bench_test_magic_numbers_e::BENCH_HEADER) { if (frame.data8[0] != (int)bench_test_magic_numbers_e::BENCH_HEADER) {
return; return;
} }
withHwQcActivity = true; setHwQcMode();
bench_test_io_control_e command = (bench_test_io_control_e)frame.data8[1]; bench_test_io_control_e command = (bench_test_io_control_e)frame.data8[1];
if (command == bench_test_io_control_e::CAN_BENCH_GET_COUNT) { if (command == bench_test_io_control_e::CAN_BENCH_GET_COUNT) {
sendOutBoardMeta(); sendOutBoardMeta();
} else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_SET) { } else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_SET) {
// see also "bench_setpin" console command // see also "bench_setpin" console command
qcDirectPinControlMode = true;
setPin(frame, 1); setPin(frame, 1);
} else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_CLEAR) { } else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_CLEAR) {
qcDirectPinControlMode = true;
setPin(frame, 0); setPin(frame, 0);
} else if (command == bench_test_io_control_e::CAN_QC_ETB) { } else if (command == bench_test_io_control_e::CAN_QC_ETB) {
uint8_t dcIndex = frame.data8[2]; uint8_t dcIndex = frame.data8[2];

View File

@ -28,8 +28,6 @@ CanWrite::CanWrite()
PUBLIC_API_WEAK bool boardEnableSendWidebandInfo() { return true; } PUBLIC_API_WEAK bool boardEnableSendWidebandInfo() { return true; }
extern bool withHwQcActivity;
static uint16_t m_cycleCount = 0; static uint16_t m_cycleCount = 0;
void resetCanWriteCycle() { void resetCanWriteCycle() {
@ -67,7 +65,7 @@ void CanWrite::PeriodicTask(efitick_t nowNt) {
updateDash(cycle); updateDash(cycle);
if (engineConfiguration->enableExtendedCanBroadcast || withHwQcActivity) { if (engineConfiguration->enableExtendedCanBroadcast || isHwQcMode()) {
if (cycle.isInterval(CI::_100ms)) { if (cycle.isInterval(CI::_100ms)) {
sendQcBenchEventCounters(); sendQcBenchEventCounters();
sendQcBenchRawAnalogValues(); sendQcBenchRawAnalogValues();

View File

@ -666,8 +666,7 @@ void initSettings() {
addConsoleActionS("bench_setpin", benchSetPin); addConsoleActionS("bench_setpin", benchSetPin);
addConsoleActionS("readpin", readPin); addConsoleActionS("readpin", readPin);
addConsoleAction("hw_qc_mode", [](){ addConsoleAction("hw_qc_mode", [](){
extern bool qcDirectPinControlMode; setHwQcMode();
qcDirectPinControlMode = true;
}); });
addConsoleActionS("bench_set_output_mode", [](const char *pinName){ addConsoleActionS("bench_set_output_mode", [](const char *pinName){
brain_pin_e pin = parseBrainPinWithErrorMessage(pinName); brain_pin_e pin = parseBrainPinWithErrorMessage(pinName);

View File

@ -14,6 +14,7 @@ void printConfiguration();
void scheduleStopEngine(); void scheduleStopEngine();
bool isHwQcMode(); bool isHwQcMode();
void setHwQcMode();
void setEngineTypeAndSave(int value); void setEngineTypeAndSave(int value);
void setEngineType(int value, bool isWriteToFlash = true); void setEngineType(int value, bool isWriteToFlash = true);

View File

@ -586,9 +586,8 @@ void OutputPin::resetToggleStats() {
#endif // EFI_SIMULATOR #endif // EFI_SIMULATOR
void OutputPin::setValue(const char *msg, int logicValue, bool isForce) { void OutputPin::setValue(const char *msg, int logicValue, bool isForce) {
extern bool qcDirectPinControlMode;
UNUSED(msg); UNUSED(msg);
if ((qcDirectPinControlMode || getOutputOnTheBenchTest() == this) && !isForce) { if ((isHwQcMode() || getOutputOnTheBenchTest() == this) && !isForce) {
return; return;
} }