Skip to content

Commit

Permalink
Renamed facility to logbook and logbook name
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan committed Oct 31, 2020
1 parent 5fbb598 commit 2cd6560
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 193 deletions.
71 changes: 38 additions & 33 deletions Logical/mappLogbook/LogTypes.typ
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

TYPE
enumLogbook :
enumLogbookState :
( (*State machine*)
enumWait,
enumOpen,
enumLatest,
enumNext,
enumDetails1,
enumDetails2,
enumDetails3,
enumDetails4,
enumFilter,
enumPrep,
enumError,
enumNone
stateWait,
stateOpen,
stateLatest,
stateNext,
stateDetails1,
stateDetails2,
stateDetails3,
stateDetails4,
stateFilter,
statePrep,
stateError,
stateNone
);
enumSeverity :
(
Expand All @@ -22,21 +22,21 @@ TYPE
severityWarning,
severityError
);
enumFacility :
enumLogbookType :
(
facilityAccessSecurity,
facilityCommisioning,
facilityConnectivity,
facilityFieldbus,
facilityFirewall,
facilityMapp,
facilityMotion,
facilitySafety,
facilitySystem,
facilityTextSystem,
facilityUnitSystem,
facilityUser,
facilityVisualization
logAccessSecurity,
logCommisioning,
logConnectivity,
logFieldbus,
logFirewall,
logMapp,
logMotion,
logSafety,
logSystem,
logTextSystem,
logUnitSystem,
logUser,
logVisualization
);
enumSorting :
(
Expand All @@ -46,31 +46,36 @@ TYPE
logbookCMD : STRUCT (*Command structure*)
Refresh : BOOL; (*Read all entries*)
Update : BOOL; (*Update entries*)
Write : BOOL; (*Write a new entry*)
ResetError : BOOL; (*Reset error*)
END_STRUCT;
logbookPAR : STRUCT (*Parameter structure*)
DateNow : DATE_AND_TIME; (*Current date and time*)
TableConfig : STRING[100]; (*Hide unused rows*)
EntriesMax : UINT; (*Maximum number of entries, shadow of LOGBOOK_ENTRIES_MAX*)
FilterErrorNo : UDINT; (*Filter by error number*)
FilterErrorText : STRING[100]; (*Filter by error text*)
FilterErrorText : STRING[LOGBOOK_TEXT_LEN]; (*Filter by error text*)
FilterSeverity : ARRAY[0..3]OF BOOL := [4(TRUE)]; (*Filter by severity*)
FilterFacility : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF BOOL := [14(TRUE)]; (*Filter by facility*)
FilterLogbook : ARRAY[0..LOGBOOK_BOOKS_MAX]OF BOOL := [14(TRUE)]; (*Filter by logbook*)
FilterDateStart : DATE; (*Filter by date*)
FilterDateEnd : DATE;
Sorting : enumSorting := sortingDESC; (*Sort date asc or desc*)
AbortOnEntriesLimit : BOOL; (*Stop looking for additional entries when limit is reached*)
AutoUpdate : BOOL; (*Automatically update data*)
AutoUpdateInterval : UINT := 10; (*Interval for auto update in s*)
AutoUpdateInterval : UINT := 60; (*Interval for auto update in s*)
WriteErrorNo : UDINT; (*Error no for new entry*)
WriteErrorText : STRING[LOGBOOK_TEXT_LEN]; (*Error text for new entry*)
WriteSeverity : USINT := 0; (*Error severiry for new entry*)
WriteLogbook : UINT := 0; (*Error logbook for new entry*)
END_STRUCT;
logbookERR : STRUCT (*Error structure*)
State : enumLogbook; (*State where the error occured*)
State : enumLogbookState; (*State where the error occured*)
END_STRUCT;
logbookDAT : STRUCT (*Data structure*)
Entries : logbookENTRIES;
EntriesTotal : UINT; (*Total number of entries*)
CntSeverity : ARRAY[0..3]OF UINT; (*Counts by severity*)
CntFacility : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UINT; (*Counts by facility*)
CntLogbook : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UINT; (*Counts by logbook*)
LastUpdate : STRING[25]; (*Last refresh run*)
END_STRUCT;
logbookENTRIES : STRUCT (*Entries structure*)
Expand All @@ -81,7 +86,7 @@ TYPE
Severity : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF USINT; (*Severity*)
Code : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF UINT; (*Code*)
FacilityCode : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF UINT; (*Facility code*)
FacilityText : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[30]; (*Facility text*)
LogbookName : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[30]; (*Logbook text*)
ErrorNo : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF DINT; (*Error number*)
ErrorText : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[LOGBOOK_TEXT_LEN]; (*Error text*)
END_STRUCT;
Expand Down
2 changes: 1 addition & 1 deletion Logical/mappLogbook/LogVariables.var
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ END_VAR
VAR CONSTANT
LOGBOOK_EXECUTIONS : USINT := 10; (*Executions per cycle*)
LOGBOOK_ENTRIES_MAX : UINT := 100; (*Total number of entries*)
LOGBOOK_FACILITIES_MAX : USINT := 13; (*Total number of facilities*)
LOGBOOK_BOOKS_MAX : USINT := 13; (*Total number of facilities*)
LOGBOOK_TEXT_LEN : UINT := 200; (*Error text length*)
END_VAR
6 changes: 3 additions & 3 deletions Logical/mappLogbook/Logbook/LocalFunctions.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ FUNCTION InsertEntry
// If buffer is full check where entry fits
ELSE
// Entry is beyond scope of buffer
IF idx >= LOGBOOK_ENTRIES_MAX THEN
IF idx > LOGBOOK_ENTRIES_MAX THEN
InsertEntry := NO_SPACE;
RETURN;
ELSE
IF DAT.EntriesTotal - idx > 0 THEN
idy := DAT.EntriesTotal - idx - 1;
idy := DAT.EntriesTotal - idx;
END_IF
END_IF
END_IF
Expand All @@ -86,7 +86,7 @@ FUNCTION InsertEntry
brsmemmove(ADR(DAT.Entries.ErrorText[idx+1]),ADR(DAT.Entries.ErrorText[idx]), idy * SIZEOF(DAT.Entries.ErrorText[1]));
brsmemmove(ADR(DAT.Entries.EventID[idx+1]),ADR(DAT.Entries.EventID[idx]), idy * SIZEOF(DAT.Entries.EventID[1]));
brsmemmove(ADR(DAT.Entries.FacilityCode[idx+1]),ADR(DAT.Entries.FacilityCode[idx]), idy * SIZEOF(DAT.Entries.FacilityCode[1]));
brsmemmove(ADR(DAT.Entries.FacilityText[idx+1]),ADR(DAT.Entries.FacilityText[idx]), idy * SIZEOF(DAT.Entries.FacilityText[1]));
brsmemmove(ADR(DAT.Entries.LogbookName[idx+1]),ADR(DAT.Entries.LogbookName[idx]), idy * SIZEOF(DAT.Entries.LogbookName[1]));
brsmemmove(ADR(DAT.Entries.Severity[idx+1]),ADR(DAT.Entries.Severity[idx]), idy * SIZEOF(DAT.Entries.Severity[1]));
END_IF
InsertEntry := idx;
Expand Down
Loading

0 comments on commit 2cd6560

Please sign in to comment.