MicroP25RXMon

Status
Not open for further replies.

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Another related question. How large is your microp25rx_backup.ini file?
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Not sure it maters, but the port names that are being used are "found port /dev/cu.usbmodem121423401"
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Strangely, if I copy and paste the text from my backup and do a restore, it works perfect from the GUI.
 

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Macbook pro - silicon-based M1
I don't have a way to test the Apple M1 silicon here.

20KB in size
I tested a configuration with 10x that size, so that isn't the issue.

Strangely, if I copy and paste the text from my backup and do a restore, it works perfect from the GUI.
I think you are saying the <write config> with your backup.ini file cut-and-pasted into the GUI editor works fine. It sounds like everything is working well except for the <read config> operation. Acknowledgement / retries for USB read operation are not currently implemented. It does check for correct length and out-of-squence packets. That wouldn't explain why you are seeing a "lock-up", but I will try adding ack/retry functionality on reads next and see if it helps.
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
I don't have a way to test the Apple M1 silicon here.


I tested a configuration with 10x that size, so that isn't the issue.


I think you are saying the <write config> with your backup.ini file cut-and-pasted into the GUI editor works fine. It sounds like everything is working well except for the <read config> operation. Acknowledgement / retries for USB read operation are not currently implemented. It does check for correct length and out-of-squence packets. That wouldn't explain why you are seeing a "lock-up", but I will try adding ack/retry functionality on reads next and see if it helps.

I found a solution....it maybe just a race condition. I added a sleep for 5 seconds inside a try catch (changes in bold) and now it works perfect:

private void read_configActionPerformed(java.awt.event.ActionEvent evt) {
if(busy!=0) return;

System.out.println("read config");
total_bytes=0;
data_frame_off=0;

ta.setText(""); //clear all text

try{
//send_config causes the receiver to send BACKUP ini config information to port 6
packet_id=0; //increment this on ack for >1 frames
byte[] b = new String("send_config\r\n").getBytes();
send_frame( b, b.length, 0, 1, packet_id); //port 1 is a \n-terminated command string
Thread.sleep(5000);
} catch(Exception e) {
e.printStackTrace();
}


busy=1;
read_timeout=200;
}
 
Last edited:
  • Like
Reactions: btt

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
I found a solution....it maybe just a race condition. I added a sleep for 5 seconds inside a try catch (changes in bold) and now it works perfect:

private void read_configActionPerformed(java.awt.event.ActionEvent evt) {
if(busy!=0) return;

System.out.println("read config");
total_bytes=0;
data_frame_off=0;

ta.setText(""); //clear all text

try{
//send_config causes the receiver to send BACKUP ini config information to port 6
packet_id=0; //increment this on ack for >1 frames
byte[] b = new String("send_config\r\n").getBytes();
send_frame( b, b.length, 0, 1, packet_id); //port 1 is a \n-terminated command string
Thread.sleep(5000);
} catch(Exception e) {
e.printStackTrace();
}


busy=1;
read_timeout=200;
}
Nice work! Can you get it to work with a delay of less than 5000?
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Nice work! Can you get it to work with a delay of less than 5000?

Thanks! 1 second sleep is too short, but 2 seconds seems to work every time for me.....I assume it depends on the total length of the config / bytes from flash memory on the device. I guess the right way to do this is to block until that "send_config" is complete.
 
Last edited:

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Thanks! 1 second sleep is too short, but 2 seconds seems to work every time for me.....I assume it depends on the total length of the config / bytes from flash memory on the device.
Try replacing Thread.sleep(x) with parent.port_to=1200; Does that work with the delay?
 

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Tried it, but it only worked 1 out of 5 times...the other 4 times it froze.
Thanks. I'll look to see if there is a way that I can add the Thread.sleep for the M1 platform only. It may have to be a configuration file or something.
 

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Tried it, but it only worked 1 out of 5 times...the other 4 times it froze.

Does the following work ok?

try {
//sleep on Mac M1 platform only
if( System.getProperty("os.arch").toLowerCase().equals("aarch64")) {
Thread.sleep(2000);
}
} catch(Exception e) {
}
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Does the following work ok?

try {
//sleep on Mac M1 platform only
if( System.getProperty("os.arch").toLowerCase().equals("aarch64")) {
Thread.sleep(2000);
}
} catch(Exception e) {
}


Yes working well......pasting my full code just to make sure it is what you expect:



private void read_configActionPerformed(java.awt.event.ActionEvent evt) {
if(busy!=0) return;

System.out.println("read config");
total_bytes=0;
data_frame_off=0;

ta.setText(""); //clear all text

//send_config causes the receiver to send BACKUP ini config information to port 6
packet_id=0; //increment this on ack for >1 frames
byte[] b = new String("send_config\r\n").getBytes();
send_frame( b, b.length, 0, 1, packet_id); //port 1 is a \n-terminated command string
try {
//sleep on Mac M1 platform only
if( System.getProperty("os.arch").toLowerCase().equals("aarch64")) {
Thread.sleep(2000);
}
} catch(Exception e) {
}
busy=1;
read_timeout=200;
}
 

btt

Jew lover
Banned
Joined
Mar 11, 2020
Messages
2,585
Reaction score
2,825
Location
Wa State
Yes working well......pasting my full code just to make sure it is what you expect:



private void read_configActionPerformed(java.awt.event.ActionEvent evt) {
if(busy!=0) return;

System.out.println("read config");
total_bytes=0;
data_frame_off=0;

ta.setText(""); //clear all text

//send_config causes the receiver to send BACKUP ini config information to port 6
packet_id=0; //increment this on ack for >1 frames
byte[] b = new String("send_config\r\n").getBytes();
send_frame( b, b.length, 0, 1, packet_id); //port 1 is a \n-terminated command string
try {
//sleep on Mac M1 platform only
if( System.getProperty("os.arch").toLowerCase().equals("aarch64")) {
Thread.sleep(2000);
}
} catch(Exception e) {
}
busy=1;
read_timeout=200;
}
Thanks. I committed the change to the github repo. v011001 is available as source.
 

alphaacres

Member
Premium Subscriber
Joined
Feb 3, 2006
Messages
216
Reaction score
36
Location
Oswego, New York
The firmware version does not show the right version stuck on VER 2023010605 shows right version in show config.
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Thanks. I committed the change to the github repo. v011001 is available as source.

@btt, FYI I am Randomly seeing a NullPointerException when monitoring through the app now. I will try to figure out where but here is the console output:

set_freq 470.162500
HDU: ENC ALG = 0x80, MFID = 0x00, KEY_ID = 0x0000, TGID: 1208, evm: 2.8 %
found alias in cache, rid=3020602, UNKNOWN, i=229 MISSED LDU. FIXING.NullPointerException


I have also seen the following error:

Some characters not available in the current font, use createFont() to specify a typeface the includes them.
NullPointerException
 

dustinsterk

Member
Joined
Jun 21, 2007
Messages
67
Reaction score
36
Now it is solid as a rock! Figured it out by putting a try catch around the following and it no longer crashes (the code needs to check for nulls on all metadata it seems):
case 5 :
try{
handle_metainfo(buf,buf_len);
}
catch(Exception e) {
e.printStackTrace();
}


Example caught error(s):

java.lang.NullPointerException: Cannot invoke "String.trim()" because "wio_line1_str" is null
at MicroP25RXMon.handle_metainfo(MicroP25RXMon.java:829)
at MicroP25RXMon.process_buffer(MicroP25RXMon.java:369)
at MicroP25RXMon.draw(MicroP25RXMon.java:215)
at processing.core.PApplet.handleDraw(PApplet.java:2094)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1386)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)


java.lang.NullPointerException: Cannot invoke "String.trim()" because "site_name_str" is null
at MicroP25RXMon.handle_metainfo(MicroP25RXMon.java:849)
at MicroP25RXMon.process_buffer(MicroP25RXMon.java:369)
at MicroP25RXMon.draw(MicroP25RXMon.java:215)
at processing.core.PApplet.handleDraw(PApplet.java:2094)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1386)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
 
Last edited:
  • Like
Reactions: btt
Status
Not open for further replies.
Top