Revert "Pass Modbus RTS settings through new hardware layer settings struct"

This reverts commit d38100eb94.
This commit is contained in:
Chrismettal
2024-03-19 21:52:03 +01:00
parent 8a937dc17d
commit 4221665a59
19 changed files with 21 additions and 39 deletions
-2
View File
@@ -6,8 +6,6 @@
// in here by clicking on the "Restore Original Code" button above.
//-----------------------------------------------------------------------------
#include "custom_layer_options.h"
//-----------------------------------------------------------------------------
// These are the ignored I/O vectors. If you want to override how OpenPLC
// handles a particular input or output, you must put them in the ignored
-11
View File
@@ -1,11 +0,0 @@
//-----------------------------------------------------------------------------
// DISCLAIMER: EDDITING THIS FILE CAN BREAK YOUR OPENPLC RUNTIME! IF YOU DON'T
// KNOW WHAT YOU'RE DOING, JUST DON'T DO IT. EDIT AT YOUR OWN RISK.
//
// PS: You can always restore original functionality if you broke something
// in here by clicking on the "Restore Original Code" button above.
//-----------------------------------------------------------------------------
struct custom_layer_options {
uint8_t rpi_modbus_rts_pin; // If <> 0, expect hardware RTS to be used with this pin
};
+3 -4
View File
@@ -78,7 +78,7 @@ int analogOutBufferPinMask[MAX_ANALOG_OUT] = { 18, 19 };
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
gpioInitialise();
//piHiPri(99);
@@ -109,11 +109,10 @@ void initializeHardware(custom_layer_options& customLayerOptions)
}
}
// Modbus
customLayerOptions.rpi_modbus_rts_pin = MODBUS_RTS;
// I²C?
// Modbus?
// 1-Wire?
}
+1 -1
View File
@@ -37,7 +37,7 @@
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
}
@@ -45,7 +45,7 @@ int serialFd; //serial file descriptor
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
wiringPiSetup();
//piHiPri(99);
+1 -1
View File
@@ -264,7 +264,7 @@ void searchForIO()
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
searchForIO();
}
+1 -1
View File
@@ -813,7 +813,7 @@ void *updateLocalBuffers(void *args)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
Spi_Setup(0);
Spi_Setup(1);
+1 -1
View File
@@ -596,7 +596,7 @@ void *updateLocalBuffers(void *args)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
Spi_SetupV2(0);
Spi_SetupV2(1);
+1 -1
View File
@@ -533,7 +533,7 @@ void *updateLocalBuffers(void *args)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
Spi_SetupV2(0);
Spi_SetupV2(1);
+1 -1
View File
@@ -414,7 +414,7 @@ void kill_psm()
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
//Verify if there is any old PSM running on the background and kill it
if ((psm = connect_to_psm(0)) >= 0)
@@ -65,7 +65,7 @@ int analogOutBufferPinMask[MAX_ANALOG_OUT] = { 18 };
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
gpioInitialise();
//piHiPri(99);
@@ -66,7 +66,7 @@ int analogOutBufferPinMask[MAX_ANALOG_OUT] = { 1 };
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
wiringPiSetup();
//piHiPri(99);
+1 -1
View File
@@ -1665,7 +1665,7 @@ int mosfets8Set(uint8_t stack, uint8_t val)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
}
+1 -1
View File
@@ -162,7 +162,7 @@ void *exchangeData(void *arg)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
pthread_t thread;
pthread_create(&thread, NULL, exchangeData, NULL);
+1 -1
View File
@@ -125,7 +125,7 @@ int16_t getSwitchId()
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
}
+1 -1
View File
@@ -160,7 +160,7 @@ int mcp_adcRead(int chan)
// This function is called by the main OpenPLC routine when it is initializing.
// Hardware initialization procedures should be here.
//-----------------------------------------------------------------------------
void initializeHardware(custom_layer_options& customLayerOptions)
void initializeHardware()
{
wiringPiSetup();
mcp_adcSetup(0x68); //ADC I2C address configuration
+2 -2
View File
@@ -104,7 +104,7 @@ void glueVars();
void updateTime();
//hardware_layer.cpp
void initializeHardware(custom_layer_options& customLayerOptions);
void initializeHardware();
void finalizeHardware();
void updateBuffersIn();
void updateBuffersOut();
@@ -155,7 +155,7 @@ int processEnipMessage(unsigned char *buffer, int buffer_size);
uint16_t processPCCCMessage(unsigned char *buffer, int buffer_size);
//modbus_master.cpp
void initializeMB(custom_layer_options& customLayerOptions);
void initializeMB();
void *querySlaveDevices(void *arg);
void updateBuffersIn_MB();
void updateBuffersOut_MB();
+2 -6
View File
@@ -32,7 +32,6 @@
#include "iec_types.h"
#include "ladder.h"
#include "custom_layer_options.h"
#ifdef _ethercat_src
#include "ethercat_src.h"
#endif
@@ -265,11 +264,8 @@ int main(int argc,char **argv)
type_logger_callback logger = logger_callback;
ethercat_configure("../utils/ethercat_src/build/ethercat.cfg", logger);
#endif
// Create layer options struct to pass settings between hardware layers and other init methods
custom_layer_options customLayerOptions;
initializeHardware(customLayerOptions);
initializeMB(customLayerOptions);
initializeHardware();
initializeMB();
initCustomLayer();
updateBuffersIn();
updateCustomIn();
+1 -1
View File
@@ -610,7 +610,7 @@ void *querySlaveDevices(void *arg)
// This function is called by the main OpenPLC routine when it is initializing.
// Modbus master initialization procedures are here.
//-----------------------------------------------------------------------------
void initializeMB(custom_layer_options& customLayerOptions)
void initializeMB()
{
parseConfig();