Hello,
I am facing a Peculiar issue with a Xojo App compiled for Raspberry Pi, the same App works without any problem on my Windows, MACOS and Linux desktops…
The Problem…
I have a Listbox with some parameters that need to be sent serially to a microcontroller, Each Row of the list corresponds to a step sequence that the microcontroller needs to execute in that step routine while each row has 10 columns, of which the column 3 to column 10 are parameters pertaining to each step. Each Step has a specific address in the microcontroller’s EEPROM, so at each tick of Timer1, a string command which specifies the storage pointer is sent out serially.
The 8 individual parameters for that step need to be sent, so this is sent with at each tick of timer2, the microcontroller receives this and stores the 8 parameters in their assigned address space.
Essentially it is like a nested For loop, timer1 outer for loop while timer2 inner for loop…
I have Three Timers on a form/Window, The first timer is initiated by the user interaction with a ui element on the form/window a push button. Timer1 has a large period of 10 Seconds, This timer1 initiates another timer2, Timer2 has a period of 1 sec, 8 parameters are sent serially in Timer2.
Only Timer1 is running on the Raspberry Pi, the second timer starts the row parameters are sent out but the end of timer2 must increment to the next step, the second address pointer isn’t being sent out by timer1, so the timer1 first address pointer is sent out, serially followed by the first step parameters, this is continuously cycled.
However, the same code compiled for a desktop machine runs fine… all Steps 1 to 18 are sent sequentially in between their respective parameters. This doesnt happen on the RasPi???
Appreciate your help, thanking you in Advance…
These parameters are stored in a Text file as a CSV, at the Open event, the list is updated with the parameters…
TheA1.txt CSV file at the end of this post…
frmRunSystem Open Event code…
Var File as FolderItem
Var lstCount As Integer
Var LstIndex as Integer
lbxProcess.HeaderAt(0) = "Step"
lbxProcess.HeaderAt(1) = "Action"
lbxProcess.HeaderAt(2) = "Units"
lbxProcess.HeaderAt(3) = "Temp"
lbxProcess.HeaderAt(4) = "Pressure"
lbxProcess.HeaderAt(5) = "Action Time"
lbxProcess.HeaderAt(6) = "Inject O2"
lbxProcess.HeaderAt(7) = "inject N2"
lbxProcess.HeaderAt(8) = "Apply Vac"
lbxProcess.HeaderAt(9) = "Exe Step"
lbxProcess.ColumnWidths = "5%,40%,5%,10%,10%,10%,5%,5%,5%,5%"
#If TargetWindows Then
File = Volume(0).Child("CocoReactor").Child("Methods")
If File Is Nil Then
Return
End If
For Each Method_File As Folderitem In File.Children
If Method_File <> Nil Then
cbxMethod.AddRow(Method_File.Name)
End If
Next
#EndIf
#If TargetARM Then
File = Volume(0).Child("home").Child("pi").Child("CocoReactor").Child("Methods")
If File Is Nil Then
Return
End If
For Each Method_File As Folderitem In File.Children
If Method_File <> Nil Then
cbxMethod.AddRow(Method_File.Name)
End If
Next
#Endif
'Action Event of the push Button Setup
pbtnRun.Enabled = False
pbtnAbort.Enabled = False
ProcessLstCount = 0
Timer1.Period = 10000
Timer1.RunMode = Timer.RunModes.Multiple
The Timer1 Action Event…
Var Parm As Integer
Var FName as String
Var TxCommand as String
TxStChr = "#"
TxEndChr = "@"
TxP1 = "MU"
TxP2 = "SI"
FName = cbxMethod.Text
TxP3 = Mid(FName, 1, 2)
TxP4 = "ST"
ProcessLstCount = lbxProcess.RowCount
Parm = ProcessLstIndx + 1
If Parm < 10 Then
TxP5 = "0" + Str(Parm)
Else
TxP5 = Str(Parm)
End if
TxCommand = TxStchr + TxP1 + TxP2 + TxP3 + TxP4 + TxP5 + TxEndChr
frmMain.SerialConnection1.Write TxCommand
lblUserfeedback.Value = "Uploading Step Parameters to System:" + TxCommand
Parindx = 0
Timer2.Period = 1000
Timer2.RunMode = Timer.Runmodes.Multiple
If ProcessLstindx < ProcessLstCount - 1 Then
Else
me.RunMode = Timer.RunModes.Off
pbtnAbort.Enabled = True
pbtnRun.Enabled = True
pbtnSetup.Enabled = False
End If
Timer2 Action Event…
Var LstParPos As Integer
If Parindx <= 8 Then
lstparpos = Parindx + 2
lblUserfeedback.Value = "Uploading Data to Control Unit:" + lbxProcess.Cell(ProcessLstIndx, lstParPos)
frmMain.SerialConnection1.Write lbxProcess.Cell(ProcessLstIndx, lstParPos) + ChrB(13)
Parindx = Parindx + 1
Else
me.Runmode = Timer.Runmodes.Off
ProcessLstindx = ProcessLstindx + 1
End If
A1.txt File…
1,CoCo Powder to Reactor,125,35,0,30,0,0,0,1
2,Pre Treatment Water to Reactor,2,35,0,1,0,0,0,1
3,Pre Treatment Water to Reactor,5,45,0,1,0,0,0,1
4,PC to Alkali Vessel,2,55,0,1,0,0,0,1
5,SH to Alkali Vessel,0,0,0,0,0,0,0,0
6,AC to Alkali Vessel,0,0,0,0,0,0,0,0
7,Reaction,0,75,2,90,1,0,0,1
8,Water Repleneshing,1,75,2,10,0,0,0,1
9,Water Repleneshing,1,75,2,10,1,0,0,1
10,Water Repleneshing,1,75,2,10,1,0,0,1
11,Water Repleneshing,0,0,0,0,0,0,0,0
12,Water Repleneshing,0,0,0,0,0,0,0,0
13,Chemical,0,0,0,0,0,0,0,0
14,Drying,0,75,0,180,0,0,1,1
15,Roasting-1,0,110,1,30,0,1,0,1
16,Roasting-2,0,0,0,0,0,0,0,0
17,Roasting-3,0,0,0,0,0,0,0,0
18,Roasting-4,0,0,0,0,0,0,0,0