Can you post the contents of script 5 for me? I’m afraid I won’t be able to look at the bugs till Friday at the earliest now.


edit: managed to sneak a quick look before breakfast, I’ve found the script. I think there may be something odd going on with P.HERE / P.NEXT, etc. It probably happened when I created the PN versions of all the P ops.

I’ve also noticed another small bug with live mode, where it doesn’t always clear the output of the previous command.

Also, just noticed a much more serious bug with multiple commands (i.e. using ;)

Right this bug wasn’t too bad, but a bit obscure. Consider the following statements in live mode (this might be a bit beyond you if you don’t understand the theory behind the Teletype’s programming language):

X 5
Y 7
X; Y

One would expect that the final statement will just print out the value of Y. In fact nothing is displayed and the value of Y has changed to 5!

What’s happening is that first sub command X; adds the value 5 to the command stack, the second sub command Y, sees that there is a single value on the command stack and assumes that it should set the value of Y to it, rather than retrieve the current value of Y.

The solution is fairly straightforward, just reset the command stack between sub commands.


Next up the far more annoying bug, which caused @trickyflemming’s weird scrolling bug, amongst many other weird things. See here for the technical details.

@tehn and @zebra I’ve added -fno-common to the compiler flags to catch ambiguous declarations (i.e. global variables where the compiler is trying to infer if they should be extern or static). These leads to errors with the following variables:

init_teletype.h

  • tcTicks
  • tcOverflow

I propose the following change to make them both static in init_teletype.c only. (The same issue also in init_ansible.h and init_trilogy.h.)

--- a/src/init_teletype.h
+++ b/src/init_teletype.h
@@ -4,8 +4,4 @@
 #include "types.h"
 
-// global count of uptime, and overflow flag.
-volatile u64 tcTicks;
-volatile u8 tcOverflow;
-
 extern void register_interrupts(void);
 extern void init_gpio(void);
--- a/src/init_teletype.c
+++ b/src/init_teletype.c
@@ -23,6 +23,6 @@
 //----- variables
 // timer tick counter
-volatile u64 tcTicks = 0;
-volatile u8 tcOverflow = 0;
+static volatile u64 tcTicks = 0;
+static volatile u8 tcOverflow = 0;
 static const u64 tcMax = (U64)0x7fffffff;
 static const u64 tcMaxInv = (u64)0x10000000;

kbd.h

  • old_frame

Again, I propose to make it static in kbd.c.

--- a/src/kbd.h
+++ b/src/kbd.h
@@ -50,6 +50,4 @@
 
 
-s8 old_frame[8];
-
 extern u8 hid_to_ascii_raw(u8 data);
 extern u8 hid_to_ascii(u8 data, u8 mod);
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -4,4 +4,5 @@
 #include "kbd.h"
 
+static s8 old_frame[8];
 
 bool frame_compare(u8 data) {

edit 2017-04-22: I’ve made these changes on my libavr32 branch. I will post a PR soonish.

2 Likes

i need to read up on the links you posted - would it mean that tcTicks wouldn’t be available from main.c?

Yes. Not problem for the teletype code base (and init_teletype.c is only for teletype). Will you have a problem elsewhere?

If you don’t want to write to it, it would be better to add a function to return the current value IMO.

1 Like

reading only, i can change it easily - and having a function for it is a better implementation (i used it in clock div/mult implementation to calculate how long something takes)

Beta 5 posted in the first post.

Changes since beta 4.

  • Bug with sub command fixed
  • Various UI issues

Can you try this again with beta 5 please. If it still isn’t working can you print out the value of each patterns length, start and end in live mode for me.

I have successfully gotten memory stick loading and saving to work at any time, not just at boot time. Seems to be a lot more reliable, and also makes boot up really quick again.

The code is a very hackish, so I need to delete it and reorganise some of the teletype codebase before I redo it.

The plan is to implement it a little bit like how Ansible modes work, by first erasing all the current event handlers / timers and then assigning new ones just for memory stick mode (and then doing the reverse on memory stick removal). That should mean that it will be easy to write some UI for loading and saving (i.e. an “are you sure?” dialog using the pot and the button). Though I’m pretty sure I’m not going to have time to do that for 2.0 final.

The changes to libavr32 are very minimal, but it will require a small update to the config.mk for all modules. I’ll create issues on each repo when the time comes.

Aiming for a new beta by the end of this week.

6 Likes

@sam installed beta 5 last night. first of the betas i’ve tried, wonderful additions throughout!

one issue i ran into this afternoon. running 1 script clocked from meadowphysics after about 45 minutes the screen went black and all seemed lost. LEDs were still lit on the TT but no keyboard response. All is well upon reboot, but if it’s any help the script was close to the following:

1:
x toss; y toss
if x: cv 4 pn.next 0
if or x y: tr.p 4
if or x y: cv 3 rand vv 1000

and pattern 0 was about 6 values long

barring the blank screen, the new sub commands, aliases, etc all seem like awesome additions to this device

edit: i’ve been running a similar script for around an hour w/ no issues. so maybe that was just a fluke

Unfortunately, it’s still not working on my end.

P.L for all 4 patterns is 8
P.START is 0
P.END is 63

@tehn would you be able to test factory preset 4Track with Beta 5 to confirm that Script 5 isn’t working? On my Teletype, it triggers all 4 gate outputs correctly but only advances Pattern 0.

I’m wondering if (sorted from likeliest to unlikeliest):

  1. The current beta broke it.
  2. I have some weird version of the preset saved.
  3. Script 5 hasn’t worked previously (I swear it did, though)

Side note: Before 2.0 is officially released, it would be nice to add a few more default Scenes to show off the new features. One notable thing to me is that the standard Scenes include remote examples for the Trilogy, but not Ansible.

@tambouri looking at your script I can’t see that you’ve done anything wrong with it. When it the screen went blank, did the script keep running? How fast was the MP trigger running at?

@trickyflemming can you upload the script you’ve been running?

As an aside, if my understanding is correct, I think it’s possible to bake scripts into the firmware image. So it would be possible to have a factory selection, it’s not the most straightforward thing to do, and I won’t have time to do it now. But if someone else wants to have a go I can point them in the right direction.

Here’s the script as it exists on my USB stick: tt03.txt (1.1 KB)

1 Like

I think my clock was around 100ms. the TT screen went blank, the script stopped, and CVs hung on their last value. Just happened that once, played w/ a similar script for another couple hours yesterday evening, and couldn’t duplicate the problem

is there a specific pattern op that is failing?

i’d be up for contributed factory scenes!

we can get factory scenes into the non-beta release. the process is basically to load them from a usb disk and then use dfu-programmer to download the image and use that as the release image.

1 Like

I forgot about that. There is also a way to do it as part of the build process (I think), basically you can initialise the f flash variable to include the scripts (so long as they are stored in the internal format, i.e. scene_script_t).

If I had the time I’d write a python script to convert a text script to a scene_script_t, it would at least be very handy for development, if on flash the script you’re testing was already loaded.

Ta. Will try and have a look tomorrow.

1 Like

I just tried to import the tt03.txt @trickyflemming posted above but it is not possible due to a strange bug: I cannot go through the scenes to load one as tt always goes back to 15 after some half a second or so. This is me trying to scroll away from scene slot 15:

The brackets work fine when I scroll through the scripts when in editing mode - it’s only on scene mode after pressing esc.

@tehn on a side note and I know this is kind of a user error cause I should have removed all the s’s in the filenames: But I just erased all the scenes I stored on the USB before I upgraded to Teletype 2.0 beta by plugging it in to load the test script.

I would really appreciate a proper USB storage mode that not just overwrites everything with nothing…

What beta version are you running?

I think the script has an error: You have to replace P.HERE with P.I in script 5

(I would recommend to replace the notes too :scream_cat:)

The newest one I think: Screen says DDBF202-Dirty

Hmmm, that is the latest beta I posted. I can’t replicate on my teletype which is running newer code.

Could you have another go and try wiggling the param knob a little please?