FortiusANT icon indicating copy to clipboard operation
FortiusANT copied to clipboard

New OS for RPI4/5 causing Problems

Open decodeais opened this issue 1 year ago • 63 comments

I wanted to set up RasperiPy4 again, as I use it as a true multifunctional device (Print spooler, web server, etc.). However, with the latest version of the OS (Bookworm), some issues arose.

  • Activating the VNC server is no longer as straightforward. "raspi-config" must be called , and then "WayVNC" needs to be switched to the X backend. After that, RealVNC can be activated as usual by enabling the "VNC" option in the "Interface Options". Additionally, the "wayvnc" backend had to be uninstalled, as it caused annoying delays during boot. The old instruction in the manual is no longer entirely accurate and could be confusing.

  • Whenever "pip3" commands were executed in the installation script, the option "--break-system-packages" had to be added.

  • Now that the new Python Version 3.11 is installed, the WHL for wxPython no longer fits. The reference in the manual to MarcDobler's page was useless as the link was dead (it should be removed from the manual).

Nevertheless, I managed to generate a suitable one:

sudo apt-get install libgtk-3-dev
sudo apt-get install libpng-dev libjpeg-dev libtiff-dev
pip install -U --no-binary :all: wxPython

The generated file "wxPython-4.2.1-cp311-cp311-linux_aarch64.whl" works, The but the scales on the performance and speed indicators have disappeared.

These were the main issues. Initially, I would appreciate a suggestion on where to search for the missing scales. However, this is only a "Design" problem.

decodeais avatar Jan 31 '24 16:01 decodeais

Yeah Yeah; "Python is a WORA (Write Once, Run Anywhere) language."; everybody may judge how true the statement is. Sorry for the inconvenience, anyway.

Please suggest what changes help you forward, apart from the missing whl.

WouterJD avatar Jan 31 '24 18:01 WouterJD

  • The reference in the manual to MarcDobler's page was useless as the link was dead (it should be removed from the manual).

Hmmm... Did a quick check but don't find; please what page?

WouterJD avatar Jan 31 '24 18:01 WouterJD

Sorry, the address of marcDobler.com appeared in the message from the instalation script "4_InstallWxPython.sh".

decodeais avatar Jan 31 '24 18:01 decodeais

The missing scales look a little strange, and i would like to know, wether the generated whl in issue #440 has the same lost. It has the same wx revision number.

decodeais avatar Jan 31 '24 18:01 decodeais

I do not have an RPI4/5 so cannot test, but perhaps others can...

WouterJD avatar Jan 31 '24 18:01 WouterJD

Will you add the missing Parameter "--break-system-packages"? Or will this brake the installation for the others?

decodeais avatar Jan 31 '24 18:01 decodeais

I'm ok to do so, but in what line please

WouterJD avatar Jan 31 '24 18:01 WouterJD

every pip3 command needs it.

decodeais avatar Jan 31 '24 18:01 decodeais

I see two ways:

  1. May be, thats it is easier to use the virtual envirement to determine a special Python Version. This would fix the error messages from the Script.
  2. The second idea would be, somebody makes a minimum installation and compress it to the minimum image size (~3GB). One for Raspi0 and Raspi3/4/5.

decodeais avatar Feb 01 '24 10:02 decodeais

There is a strange behavior when I close the program. the terminal windows stays open and does not close.

22:31:31,016: FortiusAnt applies the MotorBrake power curve
22:31:35,484: Tacx2Dongle; Pedal Stroke Analysis active
22:31:35,484: ---------- BLE-devices are activated ----------
22:31:37,486: ---------- BLE-devices are deactivated ----------

Does this effect only appear with "bookworm"? I think I will look into the source code. May be you can give me a hint.

decodeais avatar Feb 05 '24 21:02 decodeais

It happens on Windows as well. Not reproducible.

Perhaps a coding error waiting for threads to complete. I don't know

WouterJD avatar Feb 05 '24 22:02 WouterJD

For me the waiting the thread problem seems be solved. I could not find the reason. I fixed the problem by "brutal force". I look for the process id from main. At the end I kill it. In FortiusAnt.py (731 )I get the PID:

#-----------------------------------------------------------------------------------
# Main program; when restart is required due to new parameters we will loop
#-----------------------------------------------------------------------------------
if __name__ == "__main__":
    multiprocessing.freeze_support()
    global RestartApplication, clv
    Kill.pid = os.getpid()
    RestartApplication = False

In FortiusAntGui.py (1502) I kill it:

if self.CloseButtonPressed == True:
            self.CloseButtonPressed = False     # Otherwise self.Close() is blocked
            self.Close()
            os.kill(Kill.pid, 9)

What do you think, will it have bad side effects?

decodeais avatar Feb 06 '24 21:02 decodeais

I found the reason for the disappeared Scales ( it was a white eagle on white ground problem). I found the reason in the speedmeter library. When I added the typecast to the color changing variables the blue background came back and the white scaling appeared again. (speedmeter.py, line 843)

                #currCol = (r1 + rf, g1 + gf, b1 + bf)
                currCol = (r1 + int(rf), g1 +int(gf), b1 +int(bf))
                
                dc.SetBrush(wx.Brush(currCol))

I have no experience how to handle this kind of problem. Should somebody write an issue on github for speedmeter.py ?

decodeais avatar Feb 13 '24 19:02 decodeais

Hi @decodeais good work.

You have greatly re-engineered to the location where the problem is created, let's see how to help.

Some questions (I assume you can answer):

  • In what function, the "currCol=" statement appears,
  • the r1, rf, g1, gf and b1, bf may be provided by FortiusAnt; can you tell me in what function-call?

If you tell me this, it avoids work for myself. I never downloaded the speedmeter code untill now.

WouterJD avatar Feb 13 '24 20:02 WouterJD

os.kill(Kill.pid, 9)

I will look into it; in fact it suggests there is some flow-error and it circumvents the problem creatively; but still no beauty. Kind a busy these days, but I will pick up.

WouterJD avatar Feb 13 '24 20:02 WouterJD

I tried to make a pull request for the speedometer software( I have no expearence with this things) . I found that there are other people withe the same problems with the intern typecast errors on the other instrumentts, but nothing seems to happen. Please keep relaxed, for me it works. I dont't want to make stress, I want to help.

decodeais avatar Feb 13 '24 21:02 decodeais

I assume it can be considered a calling error, do if you help me forward, we can solve in our code

WouterJD avatar Feb 13 '24 21:02 WouterJD

It is an internal problem in the speedmeter software. The only workaround you can do, is to change the color of the scale from white to black. it looks much better than the white on white.

decodeais avatar Feb 13 '24 21:02 decodeais

Ok, please suggest code change

WouterJD avatar Feb 13 '24 21:02 WouterJD

  1. For the Workaround: In FortiusAntGUI.py you can change the SetTicksColour from White to Black. But it looks not good.
  2. More elegant: (speedmeter.py, line 843)
               #currCol = (r1 + rf, g1 + gf, b1 + bf)
               currCol = (r1 + int(rf), g1 +int(gf), b1 +int(bf))
               dc.SetBrush(wx.Brush(currCol))

decodeais avatar Feb 13 '24 22:02 decodeais

2.. More elegant:

I cannot change this code (other than locally) so I assume I cannot help.

WouterJD avatar Feb 16 '24 15:02 WouterJD

I made my first pull request (I never done before). The problem was accepted and verified. I hope they will change it as soon as possible. In my repository is a patched version. If you no how to install it from there, you can test it. When I checked the problem, I searched the file on my hard disk and patched the line. But do you know that this is not only a Raspbian problem? It affects all OS. The problem comes from the changes in Python3.10 upwards. The behavior between integer an float in calculations has changed.

decodeais avatar Feb 16 '24 15:02 decodeais

The behavior between integer an float in calculations has changed.

I my opinion a fundamental design of Python error not to implement strict data typing...

WouterJD avatar Feb 16 '24 16:02 WouterJD

You don't have to declare the Type, but you have to find out to what it has mutated. I agree.

decodeais avatar Feb 16 '24 16:02 decodeais

I'am afraid that this problem caused some displacements in the GUI. I had to move some Buttons. You should think about fixing the Python version. On the Raspberry it would be possible to fix the OS too. I told you, I would prefer to make a image. We Would have to define: OS version ,Preinstalled apps, Passwords ... Then we could make a installation and compress it like the Kodi or Elec images.
The last problem would be to find a Server, but I think we don`t need much space.

decodeais avatar Feb 16 '24 16:02 decodeais

Well, not helping the subject but sure fun to read https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

I did not get to the end of this stunning text 😉

WouterJD avatar Feb 16 '24 16:02 WouterJD

This is what it looks like when a mathematician tries to code

decodeais avatar Feb 17 '24 09:02 decodeais

Does this effect only appear with "bookworm"? I think I will look into the source code. May be you can give me a hint.

I created this problem with the introduction of the GearboxOverlay window; forgot to close the window. So my version is now OK again; please check whether it OK on your system now.

Issue was caused 2024-01-24 implementing #456, source module FortiusAntGui.py

A basic way to test the user-interface is to run ..\pythoncode\FortiusAntGui.py and check whether it properly ends.

WouterJD avatar Feb 17 '24 20:02 WouterJD

I did not see a gearbox window when I stopped on Linux.
This would be a better solution to fix the bug, but kill worked too😉. I can test next week.

decodeais avatar Feb 17 '24 20:02 decodeais

The GearboxOverlay is always created but hidden. It's shown when FortiusAnt is Not on top And gearbox is used

WouterJD avatar Feb 17 '24 21:02 WouterJD