|
while(true) {
int i;
if(-1!=(i=MidiSerial.read())) {
MidiSerial.write(i);
}
}
Did you author these routines? if so, you might want to look at them in detail so be sure handshaking is not the source of lag. Something may be waiting on something else.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
What handshaking?
There are two lines. TX and RX
There are no control lines.
There is nothing to handshake.
It's two wires.
To err is human. Fortune favors the monsters.
|
|
|
|
|
looking at all eight bits? any Control characters?
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Nah, it's just midi protocol over the wire.
The receive buffer was too big by default. I turned it down and it improved things a lot. Unfortunately I can't eliminate it so I may have to switch to USB anyway.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Buffer mismatches will cause problems too.
Long ago, I had similar problem.
Had to bypass and and do my own buffering. What a pain.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Are these blocking reads/writes?
Even if they are not I might be tempted to shunt the write on to another thread and have a send queue.
Good luck - it sounds like you are within sight of the finish line here.
|
|
|
|
|
They don't block. This is a hardware UART with internal send and receive buffers. I think that is my problem (maybe?).
The issue with scheduling on this RTOS is it's too simplistic and easy to starve. The scheduler isn't bright.
It's not CPU idling on I/O that is the problem, which punting to another thread would solve.
It's simply latency between the time the data gets received and it gets sent. My CPU is running like a greased pig.
Edit: I've got some hardware coming today which will hopefully allow me to switch all the MIDI stuff to USB. That may solve my problem by sidestepping the hardware UARTs altogether.
My other option is to just bit bang the serial myself, but I don't like that.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I remember the UART buffering / lag problem! Sometimes these chips are too smart for their own good.
Back in the day, there was a bit one could set somehow that would disable the buffering at least on some UART's, we had to actually order specific manufacturer UART's - worked like a charm, except then I had to tie in the interrupt so not to overwrite the byte being sent, and that was flaky because, well, it was an interrupt, and changing interrupt priorities didn't really fix the problem. Since we were sending small packets of data, I ended up doing a "write byte", "check for TX complete loop", "write the next byte". But that was for writing. For reading, I didn't much care if it was laggy.
|
|
|
|
|
My first optimization would be putting "int i" outside the loop. But since I don't know C++, it maybe makes no difference.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
In this case it makes no difference to the compiler. It just basically gives the compiler a stack size and an offset, and it would have those no matter where it is in the code. "int i;" doesn't create any executable instructions.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I'm looking at this one[^] but figure I'd ask here for tips, horror stories, etc.
And if you're wondering, normally I would just use a 10 speed bike, but we have HiLLs. Big ones.
|
|
|
|
|
I have a RadCity that I'm moderately happy with. It's way more bike than I deserve though.
Pros:
- the Rad bikes are relatively cheaper as you buy direct
- integrated rear rack
- hills are not much of an issue, unless you run out of juice (I do get about 70km off a charge, but I tend to only use the first level of power assist. It has 5)
Cons:
- you have to be fairly comfortable with putting it together yourself, or at least find a shop willing to do that
- I really should have got a step-through, as it's pretty high and can lead to my voice going higher
Whatnots:
- they are HEAVY - although that's pretty much all electric bikes. Don't live above the first floor, and you really don't want to ride it much without the motor.
- the throttle may make your bike unlawful, depending on jurisdiction
TTFN - Kent
|
|
|
|
|
Kent Sharkey wrote: I really should have got a step-through, as it's pretty high and can lead to my voice going higher
Isn't that what we used to call a girl's bike? So their skirts didn't ride up?
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Yup, but they’re also good for old folks who have trouble swinging their leg that high.
And so my skirts don’t ride up.
TTFN - Kent
|
|
|
|
|
Yeah, my knee wouldn't bend far enough anymore either. I have trouble getting out of cars and trucks if I can't swing the door all the way open.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Kent Sharkey wrote: my skirts don’t ride up. That's funny. The name "Sharkey" doesn't sound Scottish.
Software Zen: delete this;
|
|
|
|
|
I think the name is originally Irish, but my father is from Helensburgh
TTFN - Kent
|
|
|
|
|
Kent Sharkey wrote: I really should have got a step-through, as it's pretty high and can lead to my voice going higher
And thanks for the great feedback!
|
|
|
|
|
rather than edit my post, adding...
Looking at the bike you're thinking of, it seems pretty comparable to the RADs, but maybe better. I like the integration of the battery. This way, you're less likely to have someone kick off your battery (I've heard it happening with the RADs). Other specs might take a minmaxer to figure out which is better.
TTFN - Kent
|
|
|
|
|
If I was getting one (which I'm not .. yet), based on my experience with plain old bikes I'd get one with low-maintenance hub-gear and enclosed chain.
Also this particular variant seems to be lacking a luggage carrier on the back, and a proper rear light (reflector only, that's not legal to ride at night here, but maybe it is for you).
|
|
|
|
|
#Worldle #195 1/6 (100%)
🟩🟩🟩🟩🟩🎉
https://worldle.teuteuf.fr
Everybody in my part of the world can do this. But what about others?
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
|
DANG! It's currently unavailable!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
There are lots of these sorts of things around, and they're very cheap. I bought one that used Windows Notepad as the UI .
You started Notepad with the device plugged in. You hit a certain key sequence, and it emulated a keyboard typing into Notepad so it could display prompts. You then responded to prompts, setting options and such. I thought it was rather clever.
Software Zen: delete this;
|
|
|
|
|
I have a software that does it, it's called MouseJiggler and it doesn't even actually move the cursor on screen. I use it for the same reason.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|