Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen refresh out of TC interrupt in bees, c++/juce compatibility in bees, block processing, more #254

Closed
wants to merge 35 commits into from

Conversation

catfact
Copy link
Collaborator

@catfact catfact commented Feb 11, 2016

kind of a grab bag of changes, including some experiments that haven't worked out yet, and some unfinished but promising things, and finally a few things that seem useful.

  • in bees, moved screen refresh out of the TC interrupt (can't believe it was in there.) this seems to make other timed events a little smoother. the tradeoff is that if the event queue is filling up, the screen can get first partially and then completely stuck. i think it's a good trade; at least it's an immediate indicator of what is happening. @rick-monster had some thoughts about changing the way we handle a full event queue, which seemed worth pursuing.
  • started a JUCE-based graphical bees editor. pretty early stages but some tricky compilation steps and graphics context management is worked out. hoping for contributors, otherwise it will take a while to get finished.
  • relatedly, all bees headers now have __cplusplus switches, and avr32_sim sources compile again, and will even link with g++.
  • fix a minor bug with op_gate not pickling/unpickling its inputs.
  • fix a potential bug where count of graphics ops could underflow and totally screw things up (not sure if it ever happened.)
  • some more incremental tweaks to block processing on bfin - control changes can continue to be collected during an audio block, and are processed at the end of it.
  • tried implementing a cycle counter on the bfin, and added SPI protocol code and a bees operator to retreive CPU usage back to the avr32. but it doesn't work; for some reason reading the CYCLES registers totally stalls parameter change handling. very mysterious. would be nice to figure this out.
  • cleaned out a lot of dead code, comment, and print_dbg cruft. of course there is plenty more still floating around.

…g some issues. remove tons of dead code. start adding human-readable module doc generation in descriptor step. show baudrate on screen in debug build.
… now properly reports initial param values and doesn't randomly crash when booted from a scene
…d sometimes overrun the event queue on startup.) also lots of dead code and comments.
…atibility checks in bees headers. fix potentiall nasty index-underflow bug on op_gfx.
Conflicts:
	apps/bees/src/op.h
	apps/bees/src/param.c
	apps/bees/src/scene.c
@ghost
Copy link

ghost commented Feb 11, 2016

Hmm - I got interested in the event queue because all the serial-overload bees crash states I've seen seem to spew event queue-full errors, even after the overloading serial comms stimulus is removed. Maybe the change to move screen refresh out of interrupt prevents serial-overload crash already? Will test at home.

One other possibility is that bees simply cannot recover from a totally full event queue. Thinking one way to test this is rig some op or other with an event-queue-flooding payload (also experiment with different types of events for the payload), send the booby-trapped op a single bang, and see if the system subsequently recovers...

@catfact
Copy link
Collaborator Author

catfact commented Feb 11, 2016

well, when events are being raised faster than they are processed, eventually nothing will happen until something slows down (a soft timer or peripheral.)

what i was thinking of was your suggestion that the event queue should be emptied instead of saturated. i tried this at once point a long time ago and can't really remember how it worked out - certainly the effects were unpredictable. but it might be more recoverable. i would definitely want to accompany some really obvious UI thing, like immediately flashing the whole screen white or something, so the user is warned that stuff isn't necessarily going to make sense until something is throttled.

@ghost
Copy link

ghost commented Feb 11, 2016

What you're saying does make a lot of sense. Theoretically I would expect UI to get a bit intermittent & buggy under those overload conditions, but more or less keep on trucking even if some button-presses or screen-redraws get dropped.

However allowing the event queue circular buffer to wrap (effectively completely draining it from full) didn't actually prevent outright crash due to serial overload. Interesting problem - maybe b0761f7 provides a missing piece of the puzzle...

…screen. seems to work pretty well. possible for screen to become unrecoverably corrupted after an interrupted refresh, but timer events continue to be serviced?
@ghost
Copy link

ghost commented Feb 13, 2016

26c2e47 looks like a bunch of DOS line-endings leaked into files that were previously using UNIX convention. this means I can't merge my changes to param.c into a local copy of catfact/dev . Can we look at that before merging these commits?

@catfact catfact changed the title Dev screen refresh out of TC interrupt in bees, c++/juce compatibility in bees, block processing, more Feb 13, 2016
@catfact
Copy link
Collaborator Author

catfact commented Feb 13, 2016

huh! yes of course... sorry about that

@catfact
Copy link
Collaborator Author

catfact commented Feb 13, 2016

ok i blasted the whole tree with dos2unix and i have no problems merging.. does it work for you?

@ghost
Copy link

ghost commented Feb 13, 2016

that's one way to skin this particular cat I guess - kind of uneasy about it gimme a sec maybe I can squish out the mistake and retain the commit history...

@ghost
Copy link

ghost commented Feb 13, 2016

can't untangle the mess with rebase magic - but able to merge both my active branches into local copy of your dev (after the dos2unix commit) - just testing if anything's broken now...

EDIT: bfin module emulator build broken after the merge - once I fix that & re-test the serial comms we can merge this...

@catfact
Copy link
Collaborator Author

catfact commented Feb 13, 2016

i have no problem closing this request and redoing (26c2e47), the big one that seems to have introduced CRs.

dos2unix only got a few bees sources:
apps/bees/src/op.h | 408 ++---
apps/bees/src/ops/op_add.c | 180 +-
apps/bees/src/param.c | 436 ++---
apps/bees/src/scene.c | 848 ++++-----
apps/bees/src/util.h | 116 +-

and a great many things from 3-rd party code (libfixmath, fat_io_lib, and juce)

@catfact catfact closed this Feb 13, 2016
@ghost
Copy link

ghost commented Feb 13, 2016

ok other than the CR thing all ok to merge. Only 2 trivial changes required to fix emulator build. Serial overload still triggering hard crash (no more so than on the unmerged feature branch) - only difference is we now have the 'white screen of death'. I'm going to try the event-queue-bomb-payload thing see if that also triggers the crash...

@catfact
Copy link
Collaborator Author

catfact commented Feb 13, 2016

how weird, i can't get a crash at all now with timers, even with several running at 1ms. i suppose serial interrupts could be coming in at >1khz though. it clearly isn't a good idea to do this though, or expect that the avr32 can keep up with that many interrupts and keep all the timers going.

if a large-throughput transactoin is required, seems mandatory to pause app processing (i.e., disable timer IRQs) until it is done. have you tried that yet?

@ghost
Copy link

ghost commented Feb 13, 2016

nope haven't tried it - let's have a look around for the right incantation...

catfact added a commit that referenced this pull request Feb 14, 2016
(re-do of #254) screen refresh event (with WSOD), beekeep_juce, block process tweaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant