E' un file di script communicator (.sce)
<ExecutableConfig version="05.10">
<Scripts>
<Script path="./scripts/TMC220X.js"/>
</Scripts>
<LibraryPaths/>
<PluginPaths/>
<ScriptArguments/>
<Options withScriptWindow="0" notMinimized="0" minScVersion="4.18"/>
</ExecutableConfig>
che va a chiamarmi un file .js
Piccolo esempio
// ****************** Start COM-Port ********************************
var serialPort = scriptThread.createSerialPort();
var baudrate = 115200; //115200 57600 9600
var anticollisionTime = 3 * 80 * 1000 / baudrate;
var receivedData = [];
var packetsSend = 0,
packetsReceived = 0;
var chip = {
TMC2208: "TMC2208",
TMC2209: "TMC2209"
};
var currChip = chip.TMC2208;
var settings = scriptThread.getMainInterfaceSerialPortSettings();
UI_COMPORT_comboBox.addItem(settings.name);
for (var i = 1; i < 50; i++) {
UI_COMPORT_comboBox.addItem("COM" + i);
}
function chipChanged() {
currChip = UI_Chip_comboBox.currentText();
initTreeWidget(AllRegisters, UI_GeneralTreeWidget);
UI_StallGuard_groupBox.setEnabled(currChip === chip.TMC2209);
}
function connectButtonClicked() {
if (UI_Connect_pushButton.text() === "Connetti") {
//var x = UI_COMPORT_comboBox.currentText();
serialPort.setPortName(UI_COMPORT_comboBox.currentText());
if (serialPort.open()) {
serialPort.setBaudRate(baudrate);
serialPort.setDataBits(8);
serialPort.setParity("None");
serialPort.setStopBits("1");
serialPort.setFlowControl("None");
serialPort.setDTR(true);
serialPort.setRTS(true);
UI_Connect_pushButton.setText("Disconnetti");
UI_Chip_comboBox.setEnabled(false);
packetsSend = 0;
packetsReceived = 0;
if (initAfterConnection()) {
UI_tabWidget.setEnabled(true);
return; // connection successful
}
} else {
scriptThread.messageBox("Critical", "Errore", "Non posso aprire la porta seriale.");
}
}
con un'interfaccia grafica (.ui)
Piccolo esempio
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Zonalimitatore</author>
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>920</width>
<height>620</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>920</width>
<height>620</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>920</width>
<height>620</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>920</width>
<height>620</height>
</size>