WouterJD / FortiusANT

FortiusANT enables a pre-smart Tacx trainer (usb- or ANT-connected) to communicate with TrainerRoad, Rouvy or Zwift through ANT or Bluetooth LE.
GNU General Public License v3.0
148 stars 78 forks source link

Testing Raspberry_Release6 #274

Closed decodeais closed 3 years ago

decodeais commented 3 years ago

I started the test. First problem I saw was that the LED's for Tacx and Shutdown show a dim light. I changed them to GPIO16 and DPIO20. On this ports every thing is OK. The reason are the default internal pullups. Another solution would be to make them activ low and connect them to a power pin, Second Problem switching on does not work on RPi4 by GPIO5. I made a bridge to GPIO3, then it works, but there may be trouble when I2C should be used.

WouterJD commented 3 years ago
  1. I did not realize pull-up/pull-down difference during Raspberry Pi start-up untill FortiusANT is running, because then LEDs are initialized. The selection was 5 leds on a row next to GND. To be added in manual "dim light when booting" I don't know whether it's a problem.

  2. I don't understand what you mean re GPIO5. Please explain.

Thanks for feedback!

decodeais commented 3 years ago

When the program runs everything is OK. Such dimmed LEDs make me nervous. In such situations i am always thinking is there something wrong? How do you switch on again. On some RPi you can use GPIO5, on the RPi4 you can use GPIO3 to restart. I made bridge from the button input to this input. Now I can restart with te same button.

WouterJD commented 3 years ago

How do you switch on again.

Good point, please provide some more info. As complete novice on RPI I pull plug and reconnect, but you are going to give a better solution, I understand😉

decodeais commented 3 years ago

Make a wire bridge from the button (GPIO12) to GPI03 and it works to switch on. This was the reason for connecting the button in my version to GPIO3. It saves one IO.

WouterJD commented 3 years ago

Ref

There's nothing to build here, but we need to understand how to wake up the Pi from a halt state before we build the shutdown functionality. Simply put, shorting pins 5 and 6 (GPIO3 and GND) together will wake the Pi up from a halt state.

You mean: FortiusANT should use GPIO3 instead of GPIO5?

decodeais commented 3 years ago

For the RPi4 GPIO3 is a better solution, but I don't know all variants. I think GPIO3 was used by I2C too. But pull down this pin should by also possible. In my manual I additional configured the start of the shutdown in the config.txt file. It is nice to be able to shutdown without additional software.

WouterJD commented 3 years ago

my manual I additional configured the start of the shutdown in the config.txt file

DId I miss your manual; please share link

decodeais commented 3 years ago

Its only in the discription how to install jow to install without any display or keyboard. https://github.com/decodeais/FortiusANT/blob/Raspi-Status-LED/doc/HeadlessRaspi.md May be found it here, but I think you do not need the special bootloader update. https://stoffl.info/2020/03/31/how-to-raspberry-pi-4-gpio-ein-und-ausschalten-power-on-off-button/

BikeBeppe64 commented 3 years ago

Its only in the discription how to install jow to install without any display or keyboard. https://github.com/decodeais/FortiusANT/blob/Raspi-Status-LED/doc/HeadlessRaspi.md

My 2 cents:

IMG_20210308_165602.jpg

WouterJD commented 3 years ago

Good work @BikeBeppe64 ! In next version, button is on GPIO3 for described reasons. Just modify https://github.com/WouterJD/FortiusANT/blob/Raspberry_Release6/pythoncode/raspberry.py#L129

  • we can install Raspberry OS on a SD card * USB 3 ...

What is the reason that the SD_card on USB3 is faster than in the onboard SD-card slot?

WouterJD commented 3 years ago

@decodeais @wtal710174 @meanhat @martin-vi @BikeBeppe64 what do you think, should GPIO-pins be customizable? -l [on|off]/3/5/6/13/19/26 (defaults if not specified)

JSON:

[Raspberry] Leds = True | False LedTacx = 5 LedShutdown = 6 LedCadence = 13 LedBLE = 19 LedANT = 26 BtnShutdown= 3

WouterJD commented 3 years ago

Its only in the discription

@decodeais I saw that link and assumed that issue #192 would contain all info; no problem - has been adopted with pleasure

wtal710174 commented 3 years ago

@decodeais @wtal710174 @MeanHat @martin-vi @BikeBeppe64 what do you think, should GPIO-pins be customizable? -l [on|off]/3/5/6/13/19/26 (defaults if not specified)

@WouterJD: Yes i think this is a great idea, it allows to quickly configure the pins used and does not really affect the code. Maybe another option for the button to specify, if the button is connected as pull up or pull down button.

MeanHat commented 3 years ago

@WouterJD - release 6 works well on RPi 0 in ANT+ mode (I wanted to obtain a log file for ANT in order to allow the miniTFT to work with ANT as well as BLE like you suggested). I have yet to get RPi0 and Bluetooth to work despite Node adaptations for Armv6l architecture. Like @wtal710174 I like the idea of making the GPIO pins customisable.

BikeBeppe64 commented 3 years ago

Good work @BikeBeppe64 ! In next version, button is on GPIO3 for described reasons. Just modify https://github.com/WouterJD/FortiusANT/blob/Raspberry_Release6/pythoncode/raspberry.py#L129

  • we can install Raspberry OS on a SD card * USB 3 ...

What is the reason that the SD_card on USB3 is faster than in the onboard SD-card slot?

https://www.raspberrypi.org/documentation/hardware/raspberrypi/usb/README.md

bandwidth and I can use more than one OS on IT.

WouterJD commented 3 years ago

@BikeBeppe64 I have added it to the manual in section "Installation decisions"; the manual will remain a straight-forward FortiusAnt-dedicated installation which is good for the novice and a reference for others.

WouterJD commented 3 years ago

release 6 works well on RPi 0 in ANT+ mode

@MeanHat I'm really looking forward to the docu; I will integrate with pleasure. Rpi0 would be THE device for the FortiusAnt bridge. Could be a EUR 25,= solution (excluding the ANTdongle, but BLE available)

MeanHat commented 3 years ago

@WouterJD - As requested, here are some suggested additions/changes for RPi0 which I hope are useful. This explains some of the differences and how to get it running with ANT (it will need a further script and one modified script based on @martin-vi's instructions to do this. I have highlighted the changes that would be needed. FortiusAnt User Manual v6 - suggested RPi0 modifications.docx I think the next step for me is to continue to figure out the install of BLE on RPi0 with armv6l architecture or ask for help. Hope this helps and is what you were looking for...

WouterJD commented 3 years ago

@MeanHat thanks for the feedback. Unfortunately, github does not provide a neat WYSIWYG and version-managed wiki and therefore it's word/pdf.

WouterJD commented 3 years ago

I think the next step for me is to continue to figure out the install of BLE on RPi0 with armv6l

Is the message that FortiusAnt fully works on Rpi0, with exception of -g?

WouterJD commented 3 years ago

Manual and scripts promoted to Raspberry_Release6; I will do a test myself as well.

MeanHat commented 3 years ago

@MeanHat thanks for the feedback. Unfortunately, github does not provide a neat WYSIWYG and version-managed wiki and therefore it's word/pdf.

  • SSH remark added
  • password remark already there
  • Rpi0 mentioned; manual focusses on Rpi3/Rpi4
  • 2_InstallPackagesANT.sh --> please provide
  • 2_InstallPackagesBLE.sh renamed
  • 4_InstallWxPython.sh renamed and modified
  • 9_GrantAccessToUSB_withReboot --> please provide additional rules. I do not particularly like the cat>> construction and would prefer to have a 10-usbaccess.rules file in the directory. What do you think? Also [SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="usbtacx"] might be generic enough. I would keep it simple; if somebody wants to finetune USB-access, I would leave that for "personal refinement". See also 3.12.2 Installation decisions.
  • Command line reference added
  • Button / TFT; planned for release 6.1. I guess that there are many possibilities which we cannot support all in FortiusAnt. As soon as my TFT arrives we can do the integration and then document it as well.

Great work @WouterJD -

I've just realised that parameter -D-1 means no ANT dongle so:

  1. that would need to be reflected in last text before 3.12.6 '(If you want to start-up with other parameters, you can modify FortiusAnt.sh. For example, the run headless remove “-g” and to use ANT remove “-b” and -D-1. (See section 4.2 for more information). Right-click and start editor:' and
  2. add "-D-1" to section 4.2.

Also:

MeanHat commented 3 years ago

I think the next step for me is to continue to figure out the install of BLE on RPi0 with armv6l

Is the message that FortiusAnt fully works on Rpi0, with exception of -g? In summary for RPi0:

  • GUI. Yes, that's correct. Someone smarter and more patient than me might be able to get the GUI working (when I have tried to install wxPython is takes almost a day (as pointed out by others) and ultimately failed). I will try again though.
  • ANT. Works fine (one install running FortiusANT headless for several months)
  • BLE. Not working yet as result of armv7l to armv6l conversions but still testing. I will let you know. I think this is more of a priority than the GUI as I suspect the main attraction of the RPi0 is the low cost and a display/monitor would add to the cost
WouterJD commented 3 years ago

-D-1 is already in manual, I think. succes modified in code and (next) manual

MeanHat commented 3 years ago

@WouterJD - here is an early draft for adding ANT dongle to install 9. DRAFT_forANTdongle-9_GrantAccessToUSB_withReboot.sh.docx along with comments

WouterJD commented 3 years ago

@MeanHat this evening I will do a test with ANT; enough dongles available :-)

When enhancing a Tacx Fortius with Raspberry Pi0 or Pi4, I would think the price-difference is not very important compared to the whole (Tacx + RPI + work), differently from building a commercial product. If you would build a "Tacx Fortius 2021 Zwift Ready", why would you chose for a Raspberry Rp0?

MeanHat commented 3 years ago

@MeanHat this evening I will do a test with ANT; enough dongles available :-)

When enhancing a Tacx Fortius with Raspberry Pi0 or Pi4, I would think the price-difference is not very important compared to the whole (Tacx + RPI + work), differently from building a commercial product. If you would build a "Tacx Fortius 2021 Zwift Ready", why would you chose for a Raspberry Rp0?

Good luck with the testing this evening @WouterJD. And you're right that the cost difference is not so huge in relation to the total.

MeanHat commented 3 years ago

@WouterJD - good news. The RPi0 is now working in Bluetooth mode! Here's a photo of the output from simulation mode:

Screenshot_20210310-152720

I'll test it with a trainer and let you know. Would you like me to send you the list of instructions I used or would you prefer me to try to build them into your set up scripts?

MeanHat commented 3 years ago

Probably main reasons for choosing RPi0 are lower cost, smaller form factor and lower power consumption but not necessarily major issues

On Wed, Mar 10, 2021 at 4:05 PM Wouter Dubbeldam @.***> wrote:

@MeanHat https://github.com/MeanHat this evening I will do a test with ANT; enough dongles available :-)

When enhancing a Tacx Fortius with Raspberry Pi0 or Pi4, I would think the price-difference is not very important compared to the whole (Tacx + RPI + work), differently from building a commercial product. If you would build a "Tacx Fortius 2021 Zwift Ready", why would you chose for a Raspberry Rp0?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/WouterJD/FortiusANT/issues/274#issuecomment-795658960, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARS665GREYVCWBDX6XVPXLDTC6KCZANCNFSM4YYDIMGA .

WouterJD commented 3 years ago

@MeanHat I have reviewed the install scripts and made some minor modifications; [PiShare] is now also automated and scripts can be re-run.

WouterJD commented 3 years ago

Here is an early draft for adding ANT dongle to install 9

@MeanHat please refer to 9_GrantAccessToUSB_withReboot.sh and Show USB devices.sh in our branch.

PS. Are we sure that ant-usb2.conf does not exist? We now simple overwrite. I did not check it and cannot do without complete reinstall.

PS2. If these files are "ours" why not name them like that FortiusAnt-usb2.conf and FortiusAnt-usbaccess.rules?

MeanHat commented 3 years ago

@WouterJD - thanks for links to additional scripts.

I'm about to test RPi0 setup again using your latest scripts. Suggestions/questions I had at this stage are:

  1. Should we accept that it is recommended to run RPi0 headless without GUI because installing wxPython is time-consuming and complex (though the ideal solution is that someone creates a pre-built armv6l wxPython package like the one from @wtal710174 that you use in your script)? If so, install script 4 can be skipped for RPi0.
  2. Also, to avoid wxPython I removed (commented out) wxPython from "requirements.txt" to avoid receiving a large number of error messages.
  3. In script 3 I changed the source for RPi0 (with armv6l rather than armv7l) to https://unofficial-builds.nodejs.org/download/release/v14.15.3/node-v14.15.3-linux-armv6l.tar.xz. This worked OK.Would it be possible to detect the RPi architecture and then select appropriate download (perhaps using "uname -m")?
WouterJD commented 3 years ago
  1. Manual says "If you want to use the GUI, a modified wxPython must be installed. Otherwise, you may skip this step. Skip for Rpi0. If wxPython is not there, constants.py will detect and set GUI=False and FortiusAnt will run without -g option.
  2. Perhaps deploy a requirementsNoGUI.txt (deployed to branch)
  3. Tell me what uname -m gives on Rpi0
MeanHat commented 3 years ago
  1. Sounds good
  2. That would work well but requires an additional requirements.txt file (if you're happy having an extra file)
  3. uname -m gives armv6l on RPi0W and armv7l on RPi3B+. I don't have an RPi4 to check
MeanHat commented 3 years ago

@WouterJD - I have tested the scripts on RPi0. The script numbers refer to the numbered list below. General comments are (a) I miss the relative speed of an RPi3 or 4! (b) now seeing "Executive in Terminal" option when double clicking script from file manager (can't explain this but positive news) and (c) love your scripts: makes install significantly easier. Scripts:

  1. OK
  2. OK
  3. I modified script as follows: (a) line 5 changed NodeJS=...armv7l... to ...armv6l... (b) line 14 changed wget target to: https://unofficial-builds.nodejs.org/download/release/v14.15.3/ Installed OK and by using the same 14.15.3 version it resulted in same node -v and npm -v results as expected
  4. X skipped
  5. Modified requirements.txt file to removed (commented out) wxPython. Installed OK and avoided the multiple errors (reported PATH errors related to cli_exit-tools, lib-programname etc. where recommended to add home/pi/.local/bin to PATH
  6. OK
  7. OK
  8. X skipped
  9. 90 OK; 9 OK
  10. (a) start up on reboot works OK and launches FortiusAnt (b) modified /raspberry/FortiusAnt.sh parameters to -a -b -s -d127. Mission success! I'll try with actual trainer next
WouterJD commented 3 years ago

Scripts 3 and 5 updated for Rpi0

WouterJD commented 3 years ago

I did a complete reinstall and ANT works immediatly! Great collaboration!

Capture

WouterJD commented 3 years ago

Bad experience: I (mistakenly) put a BLEdongle in the raspberry. Some special things occurred (flickering screen etc). The BLE-dongle was reported by the lsusb command.

BUT: After removal, BLE was dead and I decided to reinstall the system; which provided another end:end test, which takes 15 minutes from first boot.

MeanHat commented 3 years ago

Great work! 15 minutes to completely reinstall is super fast and a further confidence boost. All looking great! Is there anything else you would like a hand with?

MeanHat commented 3 years ago

Scripts 3 and 5 updated for Rpi0

The 2 new scripts look like a great solution. I'll happily test them tomorrow on RPi0 :)

WouterJD commented 3 years ago

I have updated all scripts They are all rerunnable and fit for Rpi0; of course warning that wxPython is not available

I have run the scripts and from a clean disk it ends with FortiusAnt running :-)

This is good for USB-connected Tacx trainers and BLE-communication. When ANT-communication is desired, some modifications are required. Will check manual for that.

MeanHat commented 3 years ago

Of course. I'll take a look and get back to you with any comments. Great work.

MeanHat commented 3 years ago

@WouterJD - in FortiusAntMain.sh all old the logfiles are deleted. I wondered if you might also want to empty the WasteBasket to prevent the build-up of a large number of files over time. In the python program for the minTFT display I set a number of files I wanted to retain (in case I needed to to any retrospective troubleshooting) and then deleted all the older ones in '/home/pi/.local/share/Trash/info/.' and '/home/pi/.local/share/Trash/files/.'

WouterJD commented 3 years ago

In FortiusAntMain.sh all old the logfiles are deleted

Instead of rm *.log *.json *.tcx 2>/dev/null use find ./ -name '*.log' -type f -mtime +30 -delete find ./ -name '*.json' -type f -mtime +30 -delete find ./ -name '*.tcx' -type f -mtime =30 -delete ?

Something similar for the trashcan?

PS. trascan directories are created on first delete :-)

MeanHat commented 3 years ago

In FortiusAntMain.sh all old the logfiles are deleted

Instead of rm *.log *.json *.tcx 2>/dev/null use find ./ -name '*.log' -type f -mtime +30 -delete find ./ -name '*.json' -type f -mtime +30 -delete find ./ -name '*.tcx' -type f -mtime =30 -delete ?

Something similar for the trashcan?

PS. trascan directories are created on first delete :-)

I think that would work really well and 30 days sounds appropriate to retain the log etc. files. Regarding the Wastebasket, if the most recent log etc. files are kept in the original folder then the whole wastebasket can be emptied? I understand it is necessary to clear out both '/home/pi/.local/share/Trash/info/.' and '/home/pi/.local/share/Trash/files/.' folders. Hope that works OK.

MeanHat commented 3 years ago

@WouterJD - your Manual is a really impressive and fabulous achievement. And your English is really excellent. I have gone through the entire manual and made some suggestions for your consideration. In some cases I have checked for errors and in others I have suggested text which may make it easier to understand some of the complexities. I have tried to follow Plain English guidelines (https://plainenglish.co.uk/) as these have been found to be a good basis for English language manuals used internationally. I hope the suggestions are useful but please feel free to disregard any or all of them.

Wauw Keith, what a great job you did; thanks for compliments. I revised the manual and adopted 99% of the remarks. Attached is 6.0.d. Section 5.1 is rewritten, remark on GUIlogfile added. FortiusANT User Manual 6.0.d.zip

@WouterJD - your manual looks fabulous. It's a massive piece of work and really comprehensive and (I think) very easy to read and use. Hopefully it will inspire even more people to use your FortiusAnt system with the confidence to install it. The range of installation options is huge ranging from top end laptop and graphics to the affordable RPi. You've kept so many old Tacx trainers out of landfill and hopefully many more to come (let alone kept so many more people fit during Covid)!

WouterJD commented 3 years ago

OK. So manual ready; last updates for FortiusAntMain.sh and then Raspberry_Release6 will be published

WouterJD commented 3 years ago

...

echo Trashcan emptied (keep 1 month)
find /home/pi/.local/share/Trash/ -name '*.log*'  -type f -mtime +30 -delete
find /home/pi/.local/share/Trash/ -name '*.json*' -type f -mtime +30 -delete
find /home/pi/.local/share/Trash/ -name '*.tcx*'  -type f -mtime +30 -delete

echo Log-files from previous session are deleted (keep two days)
find ./ -name '*.log'  -type f -mtime +2 -delete
find ./ -name '*.json' -type f -mtime +2 -delete
find ./ -name '*.tcx'  -type f -mtime +2 -delete

...

??

WouterJD commented 3 years ago

Pull Request now created, ready for merge.

Tonite I bought another Tacx Fortius and got it together with the Tacx Catalogue from 2012. This catalogue provided a great insight in the 2012 product offering, the types of brakes and their power curves - I have added it to the manual. Pieces fell together, check the new sections!

MeanHat commented 3 years ago

Sounds great. The additional catalogue information in the manual is very helpful. I've shared some additional catalogue information in case it is of use regarding models and features. Probably not a huge help but I thought you might want it if you have not already seen it. IMG_20210314_0001.pdf