Ive got 3 devices with Linux. Both the same software. But one has trouble reading data. I made a FB to read the settings. I read 4 settings. Read/write is ok. But after power on one is empty. Why . Cyclic task.
RW_Para : RemVar_FileRW:= (bExecute:=TRUE, bRead:=TRUE, sFileName:='../Settings/PAR_Pumps.Par',
pRemBuffer:=adrPara, szRemBufSize:=udiSize_Para ); // Read parameters at power up
cWrite:
IF NOT bInit THEN
udi_handle:=SysFileOpen(sFileName, sysfile.AM_WRITE_PLUS, ADR(udi_ErrorCode));
binit := TRUE;
END_IF
//Out_pointer:=SysFilesetPos(udi_handle,1);
udi_RetValWrite:=SysFileWrite(udi_handle, pRemBuffer, szRemBufSize, ADR(udi_ErrorCode));
//closing file
IF udi_RetValWrite < szRemBufSize THEN ui_Error:=cWriteError; END_IF//error writing data
udi_ErrorCode:=SysFileClose(udi_handle);
uiState:=cClose;
binit := FALSE;
cRead:
IF NOT bInit THEN
udi_handle:=SysFileOpen(sFileName, sysfile.AM_READ_PLUS, ADR(udi_ErrorCode));
binit := TRUE;
END_IF
udi_RetValRead:=SysFileRead(udi_handle , pRemBuffer , szRemBufSize , ADR(udi_ErrorCode) );
udi_ErrorCode:=SysFileClose(udi_handle);
bRead:=FALSE;
uiState:=cClose;
binit := FALSE;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ive got 3 devices with Linux. Both the same software. But one has trouble reading data. I made a FB to read the settings. I read 4 settings. Read/write is ok. But after power on one is empty. Why . Cyclic task.
RW_Para : RemVar_FileRW:= (bExecute:=TRUE, bRead:=TRUE, sFileName:='../Settings/PAR_Pumps.Par',
pRemBuffer:=adrPara, szRemBufSize:=udiSize_Para ); // Read parameters at power up
cWrite:
IF NOT bInit THEN
udi_handle:=SysFileOpen(sFileName, sysfile.AM_WRITE_PLUS, ADR(udi_ErrorCode));
binit := TRUE;
END_IF
//Out_pointer:=SysFilesetPos(udi_handle,1);
udi_RetValWrite:=SysFileWrite(udi_handle, pRemBuffer, szRemBufSize, ADR(udi_ErrorCode));
//closing file
IF udi_RetValWrite < szRemBufSize THEN ui_Error:=cWriteError; END_IF//error writing data
udi_ErrorCode:=SysFileClose(udi_handle);
uiState:=cClose;
binit := FALSE;
cRead:
IF NOT bInit THEN
udi_handle:=SysFileOpen(sFileName, sysfile.AM_READ_PLUS, ADR(udi_ErrorCode));
binit := TRUE;
END_IF
udi_RetValRead:=SysFileRead(udi_handle , pRemBuffer , szRemBufSize , ADR(udi_ErrorCode) );
udi_ErrorCode:=SysFileClose(udi_handle);
bRead:=FALSE;
uiState:=cClose;
binit := FALSE;