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
* Once QC direct control mode is activated the only way out is to reboot the unit!
*/
// that one could be set by rusEFI console
bool qcDirectPinControlMode = false;
// todo: how is this flag different from the one above? shall we merge?
/*board public API*/bool withHwQcActivity = false;
static bool qcDirectPinControlMode = false;
bool isHwQcMode() {
return withHwQcActivity || qcDirectPinControlMode;
/*board public API*/bool isHwQcMode() {
return qcDirectPinControlMode;
}
void setHwQcMode() {
qcDirectPinControlMode = true;
}
#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) {
return;
}
withHwQcActivity = true;
setHwQcMode();
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) {
sendOutBoardMeta();
} else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_SET) {
// see also "bench_setpin" console command
qcDirectPinControlMode = true;
setPin(frame, 1);
} else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_CLEAR) {
qcDirectPinControlMode = true;
setPin(frame, 0);
} else if (command == bench_test_io_control_e::CAN_QC_ETB) {
uint8_t dcIndex = frame.data8[2];

View File

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

View File

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

View File

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

View File

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