1
0

started smartcontrol

This commit is contained in:
Nils Ritler
2023-06-02 16:04:44 +02:00
parent 55fa80c4d4
commit 2c4867204d
2 changed files with 68 additions and 4 deletions

View File

@@ -75,9 +75,9 @@ public class FieldConnector implements DataPointListener {
* @param pathToFile path to the file of all modbus registers (C:/.../ModbusMap.csv)
*/
public void initialize(String host, int port, String pathToFile){
ModbusAccessor.getMySelf().connect(host,port);
createRegister(pathToFile);
startPeriodicalPolling();
ModbusAccessor.getMySelf().connect(host,port); //connect with Modbus
createRegister(pathToFile); //read the csv file of the modbus registers
startPeriodicalPolling(); //start periodical reading of the float values
}
private void pushToField(String label, String value){
System.out.println("Field: " + label + " " + value);
@@ -96,6 +96,6 @@ public class FieldConnector implements DataPointListener {
public void startPeriodicalPolling(){
Timer pollTimer = new Timer();
PollTask pollTask = new PollTask();
pollTimer.scheduleAtFixedRate(pollTask,0,100);
pollTimer.scheduleAtFixedRate(pollTask,0,2000);
}
}