Skip to content

Commit

Permalink
Merge pull request #4 from loupeteam/develop
Browse files Browse the repository at this point in the history
Develop -> main v0.1.8
  • Loading branch information
dfblackburn authored Dec 3, 2021
2 parents c0a1ea6 + b106082 commit b3ca699
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 328 deletions.
41 changes: 20 additions & 21 deletions MachineControl.var
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
(********************************************************************
* COPYRIGHT -- Automation Resources Group
********************************************************************
* Package: MachineControl
* File: MachineControl.var
* Author: David Blackburn
* Created: November 10, 2011
********************************************************************
* Variables of package MachineControl
********************************************************************)
VAR
gMachine : Piper_typ := (0);
END_VAR
VAR RETAIN
BootTime : TIME;
END_VAR
VAR
gSimulation : BOOL;
gActiveMode : MODE_MACHINE_ENUM := MODE_MACHINE_AUTO;
gRequestedMode : MODE_MACHINE_ENUM := MODE_MACHINE_AUTO;
END_VAR
(********************************************************************
* COPYRIGHT -- Automation Resources Group
********************************************************************
* Package: MachineControl
* File: MachineControl.var
* Author: David Blackburn
* Created: November 10, 2011
********************************************************************
* Variables of package MachineControl
********************************************************************)
VAR
gMachine : Piper_typ := (0);
END_VAR
VAR RETAIN
BootTime : TIME;
END_VAR
VAR
gActiveMode : MODE_MACHINE_ENUM := MODE_MACHINE_AUTO;
gRequestedMode : MODE_MACHINE_ENUM := MODE_MACHINE_AUTO;
END_VAR
49 changes: 25 additions & 24 deletions Piper/ANSIC.lby
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Library Version="0.01.7" SubType="ANSIC" Description="A new source library" xmlns="http://br-automation.co.at/AS/Library">
<Files>
<File>VersionHistory.txt</File>
<File Description="Exported data types">Piper.typ</File>
<File Description="Exported constants">Piper.var</File>
<File Description="Exported functions and function blocks">Piper.fun</File>
<File>PiperGlobal.h</File>
<File Description="Master Cyclic function">Piper_fn_Cyclic.c</File>
<File Description="This function looks at the response state and decides what Step or State to enter next">Piper_handleResponseState.c</File>
<File Description="Sets commands to the subsystems">Piper_setCommand.c</File>
<File Description="Reads the status of Pipes">Piper_checkResponses.c</File>
<File Description="Implements PackML state machine for Piper">Piper_PackML.c</File>
<File Description="Implements the interface to a pipe">Piper_Module_Fub.c</File>
<File Description="Returns a string for the given PackML state">PackMLStateString.c</File>
<File Description="Logs a state change.">PiperLogStateChange.c</File>
</Files>
<Dependencies>
<Dependency ObjectName="Operator" />
<Dependency ObjectName="LogThat" FromVersion="0.03.0" />
<Dependency ObjectName="sys_lib" />
<Dependency ObjectName="AsBrStr" />
</Dependencies>
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Library Version="0.01.8" SubType="ANSIC" Description="A new source library" xmlns="http://br-automation.co.at/AS/Library">
<Files>
<File>VersionHistory.txt</File>
<File Description="Exported data types">Piper.typ</File>
<File Description="Exported constants">Piper.var</File>
<File Description="Exported functions and function blocks">Piper.fun</File>
<File>PiperGlobal.h</File>
<File Description="Master Cyclic function">Piper_fn_Cyclic.c</File>
<File Description="This function looks at the response state and decides what Step or State to enter next">Piper_handleResponseState.c</File>
<File Description="Sets commands to the subsystems">Piper_setCommand.c</File>
<File Description="Reads the status of Pipes">Piper_checkResponses.c</File>
<File Description="Implements PackML state machine for Piper">Piper_PackML.c</File>
<File Description="Implements the interface to a pipe">Piper_Module_Fub.c</File>
<File Description="Returns a string for the given PackML state">PackMLStateString.c</File>
<File Description="Logs a state change.">PiperLogStateChange.c</File>
</Files>
<Dependencies>
<Dependency ObjectName="Operator" />
<Dependency ObjectName="LogThat" FromVersion="0.05.0" ToVersion="0.05.9" />
<Dependency ObjectName="sys_lib" />
<Dependency ObjectName="AsBrStr" />
<Dependency ObjectName="StringExt" FromVersion="0.14.0" ToVersion="0.14.9" />
</Dependencies>
</Library>
94 changes: 47 additions & 47 deletions Piper/PiperLogStateChange.c
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
/********************************************************************
* COPYRIGHT --
********************************************************************
* Library: Piper
* File: PiperLogStateChange.c
* Author: Josh
* Created: October 08, 2013
********************************************************************
* Implementation of library Piper
********************************************************************/

#include <bur/plctypes.h>
#ifdef __cplusplus
extern "C"
{
#endif

#include "Piper.h"

#ifdef __cplusplus
};
#endif

/* Logs a state change. */
plcbit PiperStateChange(struct Piper_typ* Piper, enum MACH_ST_enum State)
{
StrExtArgs_typ LogData;

STRING Oldstate[80];
STRING Newstate[80];

//Get the strings to log
PackMLStateString(Piper->OUT.State,Oldstate);
PackMLStateString(State,Newstate);

LogData.s[0] = (UDINT)Oldstate;
LogData.s[1] = (UDINT)Newstate;

//Log state change
logInfo(Piper->IN.CFG.LoggerName,0,"%s -> %s",(UDINT)&LogData);

//Change state
Piper->OUT.State = State;
Piper->OUT.SubState = 0;

return 0;
}
/********************************************************************
* COPYRIGHT --
********************************************************************
* Library: Piper
* File: PiperLogStateChange.c
* Author: Josh
* Created: October 08, 2013
********************************************************************
* Implementation of library Piper
********************************************************************/

#include <bur/plctypes.h>
#ifdef __cplusplus
extern "C"
{
#endif

#include "Piper.h"

#ifdef __cplusplus
};
#endif

/* Logs a state change. */
plcbit PiperStateChange(struct Piper_typ* Piper, enum MACH_ST_enum State)
{
StrExtArgs_typ LogData;

STRING Oldstate[80];
STRING Newstate[80];

//Get the strings to log
PackMLStateString(Piper->OUT.State,Oldstate);
PackMLStateString(State,Newstate);

LogData.s[0] = (UDINT)Oldstate;
LogData.s[1] = (UDINT)Newstate;

//Log state change
logInfo(Piper->IN.CFG.LoggerName,0,"%s -> %s",(UDINT)&LogData);

//Change state
Piper->OUT.State = State;
Piper->OUT.SubState = 0;

return 0;
}
Loading

0 comments on commit b3ca699

Please sign in to comment.