Добавлен статус для окончания скана

This commit is contained in:
2025-03-05 10:56:23 +03:00
parent 68794b6981
commit 26852bbec0
5 changed files with 20 additions and 42 deletions

View File

@@ -93,10 +93,10 @@ void PYModule_FirstInit(void)
DallasBus.hdallas->ds_devices = &DS;
PCHSens_InitModule(&hdallas1, &pchsens.module1, REG_PCH_NUMB_11|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module2, REG_PCH_NUMB_12|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module3, REG_PCH_NUMB_13|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module4, REG_PCH_NUMB_21|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module5, REG_PCH_NUMB_22|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module6, REG_PCH_NUMB_23|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module3, REG_PCH_NUMB_21|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module4, REG_PCH_NUMB_22|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module5, REG_PCH_NUMB_31|REG_PCH_DIODE_NUMB_1);
PCHSens_InitModule(&hdallas1, &pchsens.module6, REG_PCH_NUMB_32|REG_PCH_DIODE_NUMB_1);
/* Поиск неизвестных сенсоров */
PCHSens_FindUnknownSensors(&DallasBus);
@@ -113,7 +113,7 @@ void PYModule_ScanSensor(PCHSens_DallasBusHandle *hbus)
if (scan_cnt >= hbus->hdallas->onewire->RomCnt)
{
scan_cnt = hbus->hdallas->onewire->RomCnt;
PYModule_FillResponse(&sensor, 0);
PYModule_FillResponse(&sensor, STATUS_SCAN_END);
return;
}
if(Dallas_ReadScratchpad(&sensor.sens) == HAL_OK)
@@ -267,6 +267,16 @@ void PYModule_FillResponse(PCHSens_SensorTypeDef* sensor, Sensor_ResponseStatusT
MB_DATA.InRegs.Response.Status = status;
break;
case STATUS_SCAN_END:
MB_DATA.InRegs.Response.Location = 0;
MB_DATA.InRegs.Response.Config = 0;
MB_DATA.InRegs.Response.ROM[0] = 0;
MB_DATA.InRegs.Response.ROM[1] = 0;
MB_DATA.InRegs.Response.ROM[2] = 0;
MB_DATA.InRegs.Response.ROM[3] = 0;
MB_DATA.InRegs.Response.Status = status;
break;
// error read by location
case STATUS_ERR_READ_LOCATION:
// fill only location from holdreg