Documentation update

Imagine I end up writing a Python script to automate all the demos, and pause on prompt.should be doable.

2 Likes

If you can both detect the prompt and detect the first line feed / carriage return after the prompt, then…

I’d recommend the pause be after the command is fully entered, rather than when the prompt appears, but before the command is executed.

After all, the point is to let folks pause the playback, and then copy/paste the screen into their own terminal. At least, that’s what I would do. :slight_smile:

2 Likes

A project has emerged lol.

A Python script to:
Run automated demo scripts
Capture the vt100 output
Save to ansciienma format, run the optimizing scripts
Crop sections into individual demo files to include in the docs and convert to HTML

This puts some fun back in the drudgery I’m currently experiencing with the docs update. Turn the copy past into a programming exercise :slight_smile: In the future the scripts can be updated and batch run to update all docs on the latest firmware. Sweet!

5 Likes
[0, "o", "l"]
[0.000694, "o", "s\r\n"]
[0.002905, "o", "\u001b"]
[0.003031, "o", "[3"]
[0.003083, "o", "8"]
[0.003145, "o", ";2;150;203;89m   <DIR>   \u001b[38;2;191;"]

Capturing VT100 to asciinema format :slight_smile: It works in the player but looks like trash.

demo.zip (2.2 KB)

python autodoc.py -p COM34 -i demo.txt -f output.json -d

Detecting the various prompts proved to be a nightmare, sooooo… I added \x03 END OF TEXT (ETX) character to every prompt in the firmware. This is a non-printing character that shouldn’t mess with terminals, but it gives the automated docs/testing a way to spot the next prompt without ā€œguessingā€. It works great! (so far)

I also somehow coaxed Chad into converting the ansi2html script from JS to python, and it actually seems to work after a bit of adjustment.

Urgent things to do:

  • ā€œTyping speedā€
  • Pause at prompt and after ā€œtypingā€

TODO:

  • Control mechanisms in the command scripts that indicate where to chop things into asciinema screencasts & file name, and where to chop the HTML output into include files for the docs & file name.
  • Update docs to include the output of the above files

This seems like it could be really slick! Automated docs updates and down the path to automated testing (diff current output vs previous, highlight changes in a report).

3 Likes

demo.zip (4.5 KB)

Updates:

  • Cooperative multitasking loop captures serial in while slow typing serial out
  • Random small delay between characters to simulate typing
  • Recognize and reply to VT100 screen size query (status bar works now)

Still needs delay before enter and after prompt appears again.

Sorry for giving you extra side project. But looks like you enjoy it a byte.

1 Like

Now we’re cooking!

Latest demo. One uses autodocs, the other is manual. Can you tell which? I think it looks pretty great, and is much better than me sweating my way through the screencast without making any mistakes.

Autodocs is now in the tools folder of the bp-docs-hugo repo.

  • Cleaned up the mess into a pseudo state machine
  • Better handling of VT100 detection
  • Comments in the input script are inserted as makers in the screencast
  • Pause before enter and after prompt
  • Natural typing rate
W # W - enable PSU (interactive)
5
100
W 5 100 # W 5 100 - enable PSU (command line options)
W 5 # W 5 - enable PSU (default current limit)
w # w - disable PSU

This is the script for the screencast. The command to send is first. Comments after # are then inserted as markers automatically. This will save so so so much work now and for future updates.

TODO:

  • Script control of what is recorded and where it is saved
  • Alternate mode to record the stationary text examples to be included in the existing console widgets

@AreYouLoco - I’m actually pretty thankful. The docs need help, but going through it all manually is a freaking nightmare and SO boring. This makes it a fun project and automates updates in the future.

y
m hiz
m led
y
# sc_power_supply.json
W # W - enable PSU (interactive)
5
100
W 5 100 # W 5 100 - enable PSU (command line options)
W 5 # W 5 - enable PSU (default current limit)
w # w - disable PSU
# stop

The final piece for asciinema - control of when recording starts and stops.

# sc_power_supply.json

Blank command with file name in comment begins recording. If a file is already recording it is closed.

# stop

Blank command with stop in comment closes current recording file.

Hum. The demo script should probably be unified with the formatting of Bus Pirate scripts and tutorials. Comments above commands.

1 Like

Most of the tutorials-basic now have a screencast. Had an issue with self test aborting at the button press, but the others look ok.

Not sure where exactly to put the screencast. Currently at top, but I think it should go either in a second item after intro, or at the very end.

demo.txt (1.3 KB)

I love it! Easy to use, automate all the markers, space to setup for the next recording without cropping and editing. Wow, very please.

Next I’ll look at @henrygab 's list of suggested uses and update the docs :slight_smile:

2 Likes

A second much simpler script to create output snippets for the docs. There is something weird going on with new line and reset line, seem to get multiples out the VT100 stream that shouldn’t be there.

I’m probably going to need to add some basic vt100 parsing. Just nuking all the 0x0ds seems risky.

With some questionable post processing, simple output looks fine.

I’ve asked over at the asciinema forum if the player could export the HTML for a frame.

2 Likes

This weekend I updated the docs for writing docs and capturing terminal output with the new python scripts.

Today is a holiday, but tomorrow I’ll begin converting the docs to the new automated system. If anyone would like to help, you can pick a device demo or quick start tutorial and give it a try.

Currently there is a main command reference page and then a page for each protocol. I’d like to consolidate this somewhat. Probably not eliminating protocol specific pages, but at least adding a description of each protocol command (think flash, sniff, scan, etc) in a section of the main command reference. This makes it easier to print (to pdf, etc) and ctrl+f search. The inspiration for this is Raspberry Pi’s own rp2040/2350 docs.

3 Likes

Most of the command reference is re-written and using the auto snips now.

  • Add missing commands
  • Merger syntax and mode does into the command reference

I should have some kind of preview soon. The docs look much better and are a lot more accurate.

2 Likes

Okay! Far from complete, but here is the new master command reference page. It includes everything: basic use, global commands, modes, bus commands, mode commands, etc.

It is fashioned after the PICO SDK docs, which are a single page that documents every function in the SDK. Next I’ll remove the individual protocol/mode pages, everything will be centralized. It took a while for this style of docs to grow on me, but here is what I like about it:

  • CTRL+F on a single page to find what you need
  • Print a single page to PDF or paper, less click click click

Most of the terminal output in the first 4-5 sections is now automated with autosnippets, so it can all be updated in about 20 seconds with the python script :slight_smile:

commands-script.txt (1.3 KB)

This is the current script for creating the snippets. It will grow, and we’ll get some asciinema screencasts in there soon as well.

1 Like

Sorry deploy failed. It is updated now.

Command reference has been updated and moved:

  • Nearly all terminal output is captured with the snip script
  • Added missing bitwise commands for 2wire, 3wire.
  • Flashed out 3WIRE and DIO sections
  • All missing mode commands added and documented

The DS18B20 demo is updated to latest firmware, including snips for terminal output and a screencast.

I hope I can update 2-3 of the demos a day, but it is a lot of work.

Command reference still needs work on the INFRARED and JTAG modes, especially. There are also some global commands like scope, logic, image, dump, etc missing from the docs.

Command reference updated with all the current commands. They don’t all have great docs, but at minimum a description and a snip of the command -h help.

Removed some small pages made redundant by the command reference.

I didn’t manage to update any demos today. Next I think LED, INFRARED, and JTAG need docs + demos to finish up the command reference, then I’ll circle back to updating the existing demo.

3 Likes

Last night I had markdown formatted nightmares, let’s hope this update is done soon :woozy_face:

Today there are two new demos for LED mode:

LED mode works well, but since there has been no documentation it is primarily useful if you already now how the protocols work. Now there are two tutorials that include screencasts.

One thing I like about the LED demos is a new Protocol section at the top (WS2812, APA102). It uses actual screenshots from dodgy datasheets to show how the datasheet translates into Bus Pirate commands. I’m going to add this to all the demos where it makes sense.

Lots of other cleanup and linking in the command reference page.

I really thought I could also document bluetag, but the LED demos took most of the day.

LOVE how fast hugo renders the site. I push to github and the site is updated seconds later (was 10-15 minutes with docusaurus).

Tomorrow: bluetag
Then: Infrared (mode, binmode, demos)
Finally: Update all device demos
Cleanup: BP6 hardware design (renders, missing schematics), Enclosure v2
Bonus: More screencasts, a demo screencast for a new features overview pages

Getting there, but I may take a day off if the markdown formatted night terrors keep happening.

4 Likes

Tomorrow: bluetag
Then: Infrared (mode, binmode, demos)
Finally: Update all device demos
Cleanup: BP6 hardware design (renders, missing schematics), Enclosure v2
Bonus: More screencasts, a demo screencast for a new features overview pages

blueTag docs are up. This includes an extended device demo, and examples in the command reference.

This one was a right pain because the bluetag interactive mode prompts are different than the main Bus Pirate. I could not get it to capture with the automated screencast script, even with a bunch of hacking around in the source. I went with the command line instead.

The markdown night terrors persist, so I plan to ā€œrelaxā€ and do the BP6 updates and enclosure v2 pages tomorrow now.

4 Likes

SLE4442 device demo is updated with a more datasheet focused explanation. Not sure it really adds a lot in some places, but the overall flow is better.

SLE4442 snips in the demo and command reference updated to use autosnip. Two screencasts added for the demo and the sle4442 command.

Next I’ll probably tackle the NOR flash demo and flash command. Then I2C smart card. These are easier to update than the I2C sensor demos because the stupid sensor values change and the whole thing has to be manually edited to look right.

1 Like