Real-time audio processing for Morse code decoding requires careful handling of buffer processing, thread synchronization, and power threshold detection to prevent intermittent failures; the core issue lies in how audio samples are grouped into buffers and how state transitions are calculated, where processing entire blocks at once can cause timing misalignment when tones start or end mid-buffer, and thread collisions between background processing and UI updates can make the decoder appear to stop working.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
YAESU FT-891S 18 - CW Decoding Via The PC's Microphone - C# WPF - David G7UIVAdded:
Just find the right place in the program, make the appropriate change, and we'll run the whole thing again.
>> Speech is still very complicated. Music is simpler.
>> Is that a question?
>> Yes, the question is futile.
>> My interpretation of the data leaves little room for error.
The art of leadership is delegation.
>> That information is not available.
>> This constitutes all available data.
>> You know what they say, no good deed goes unpunished.
>> How do welcome?
How you doing? You're all right.
Let's see if we got any audio.
Let's have a look.
Audio. We got audio. Okay.
Right. Uh had not much rest today.
So anyway, I haven't even had a chance to had me sandwich yet. Never mind. It's all right. I've been I got in uh after going shopping and um I must have spent I don't know three three and a half hours trying to get a MOS code just to initially it was just to see if it could be achieved and after about 3 hours I've come up with something me chat PT and Gemini have come up with something that seems to work. So, what we're going to do, we're going to try it in a minute on a live stream. I've uh boilerplated it into the UI. It just starts straight away. I mean, I got the serial running as well, but we wouldn't normally do both at the same time. Or maybe we would. Anyway, uh so, uh let's just have a look at it and see what we got. Just going to turn the fan off.
Turn the fan off. All right. Uh, I need a drink. Anyway, I'll get that in a minute. So, here's the latest UI.
Um, snapshot. So, uh, that's the latest thing. Obviously, some CW stuff here.
CW speed pitch. Um, that's probably for sending or maybe you could do it for receiving. I don't know. Anyway, let's just get get on with it, shall we? Uh, so what have we got to look at? Um, well, we'll run the code. Now, what I've got is I've got some um YouTube videos, not by me, by others, of people sending Morse code at various speeds because I've been scanning the bands. I can't find any. I found one earlier, then it would disappeared.
So, I can't find any real Moscow, just a recording. So, because it works through the mic, it doesn't really matter.
You can just um play it through the microphone.
So, anyway, uh let's crack on with it.
Here we go. And nothing like a live demo to prove that it doesn't work or problem. So, it boots straight on into this. It's got something called power and it's constantly doing it. It's trying to decode. It's picking me up at the minute. So, what I'll do is I'll keep quiet and I'll play back some more.
Uh, now in order to do this, um, right, I think I'll bring this over into the background, maybe. Hang on.
Right, I'm going to bring this over into the background.
Reason being some of it's got the writing on it. So, I'll come up like that.
And I'm just going to press play.
So there. So, don't forget I'm streaming and I'm sending serial data.
So, what we'll do is we'll stop that one. We'll go over to the a faster one.
Now, some of these have put the word later on.
So, it's interesting, isn't it?
I got field and called. It got called. Look.
No, it's slightly adaptive. This one is.
Oh, I'm talking. Bad idea to be talking.
I'll stay shut up because if I'm talking, I'm interfering with the sound.
Uh, it's actually worse. It's worse now than when I was not live streaming. Hang on. I tell you what, I'll start start it again. Was that one?
I'll start it again cuz I'll try and keep my mouth shut.
Right.
Okay, here we go.
Well, let's switch over to a faster one.
Hang on.
All right. And a bit faster. Heat. Heat.
Let's go back down again.
Go to another one.
Uh, I started again.
Well, I'll run it without the program this time. So, it's running as an executable and we'll just go some slow So, it's gone from taking loads to taking nothing.
Now, I did say if you close the program and you run it before Windows has shut down the microphone all the way and you launch it before Windows has disposed of the microphone properly.
Hang on.
It could do something to it. So, I'll run it again as an executable.
All right. So, I'll stop it there.
I'll rewind it a bit. I'll close it.
I'll run it straight away and we'll start it again.
So, it's not taking it now. So, we'll close it. We'll wait a little bit for Windows to garbage collect the if it will, which might do seeen as there's a lot going on. We're streaming, doing all sorts together.
Right. So, I'll run it again now and restart the video.
So, it's a bit random, isn't it?
Yeah. So that's random. Does there is a function to synchronize the start again?
Yeah. So, that's not sort of working.
So, there's uh there is a I think they put me a little thing where you start it.
clears the buffer or something. We need to force the new microphone.
All right.
Right. Okay.
Um, let me talk over it. 2 4 6 8 10 2 4 6 8 10. Can you do it without me talking?
No, you can't do it with me talking.
Definitely can't do it. It's trying.
So, what it needs to do is filter out me and keep the beeps, but the beeps vary.
Anyway, that seems to function somewhat.
Not bad for 3 hours.
Not bad for three hours, but it's not reliable, I don't think.
Let's try uh the fast one again.
pause it there. I'll rewind it.
Stop it. Close it.
Give it a second. Let's just run it again. Why not run it again?
And let's start off.
See if I can upset it.
Upset it to get it to sync again.
Huh?
So close it. I'll wait for few seconds.
Windows to garbage collect.
Yeah, was working great on all four of these word videos.
And when I started streaming, it's doing not so good.
But my poor computers.
I'm trying to do a test on I'm doing my live stream. It's also doing serial packets back and forth and Morse Morse decoding probably.
Anyway, let's let's run it back up now.
All done is shut it and give it a few seconds. Few seconds.
See, it's working.
Yeah, it's more on the radio screen.
Yeah, I've just put that in quickly. I need to make it bigger. You're right.
But if I talk, it wipes it. It doesn't decode. It seems to upset. It's something happens if I talk.
set. If I go back to something I've already taken.
Yeah, it's upset it. Let's try a different one. The fast one.
Well, let's wind it back to there.
Wind it back to there. Close it. Wait for five seconds or so.
Load it up. It's some uh chat GPT and that they said it's something to do with the microphone.
It was in use. So when I stop it and start it again, it uses a different layer over the microphone is it hasn't disposed of the original microphone because it can do more than one. I don't know. which is technical. But what I need to do is make sure we somehow dispose of the microphone before we finish and start again. Let me Right. This is a new one. I'm not going to talk. Well, I'm talking already seems to sink. So, I need I'll try a different one.
Strange.
So, I need to flush the microphone, I think.
Yeah. It's weird, isn't it?
Need a way of shrink. It's It's when I start speaking.
So, run it off the program.
Tell you what, let's make let's make the screen bigger and we can see it as well.
Uh, right. Let's make the font bigger just on this bit.
font size uh 20.
Yeah.
Font weight bold 30.
Yeah. So the only trouble is it is going to fill up quickly.
It's going to fill up a bit quickly, but anyway.
So, um I need to do some work with the clean up of the microphone when we close it.
Yeah, it's gone stupid again.
Let's try a fast one.
It's run out of space.
Right.
Uh, right. So, let's make it a little bit less.
That's it. Uh, tell you what, we'll get rid of that one.
Okay, we'll do a start it from there.
Yeah. So, um I'm surprised we got it decoding all really.
I'll try to put extra stuff into it um to vary stuff. Uh because it it starts to scan between. It has to snap onto something and it starts to scan between and then it carries on.
That's weird.
tell you what I'll do.
I'll tell you what I'll do. I'll um I'll see if we can put a sync synchronize thing. I think I thought it said it did it, but I've pasted over it that many times with so you got dictionary use uses something called gel detector.
They're always German, aren't they? All these terminologies. Oh, it might be German. I don't know. Symbol clear.
That's right. Tones times clear.
So it does that does a stop before and then it does the clear. So if we start it maybe we can issue the start of a button.
All right. Let's do that. Let's do a start off the button.
All right. So it does a stop. was like sort of like a a synchronization, right? So, we find a spare button.
What button aren't we using? Uh, we're not using a clarifier at the minute.
So, let's do off the clarifier.
Yeah, we can put it in there. Um, so we want the start function on this.
No, must need the the actual name. Hang on.
Right. Decoder. There it is. Decoder start.
So yeah, once it starts, when you boot up, it might might be starting up on some noise.
So what I need to do is just do decoder start again, which does a stop and flushes its buffers and things.
So, all I got to do is put this in with this start decoding button.
Right. Okay. Let's see if it makes any difference.
So, I'll just take some code decode.
Take some boss. But, right. So, we got a thing there that starts it off. So if I do doesn't actually clear the text, does it? Tell you what I'll do. Let me clear the text as well.
Right. Let's make sure we clear the text if I can find it.
It's right at the bottom.
I need to collapse this into a so I don't have to keep searching for it.
Right. So this text block if I clear it at the same time string empty.
There we go. So that'll clear it every time I press the button.
So it goes straight into decoding. So really I should start it and do nothing till I'm ready. So if I click that.
Yeah, that's it. Right, let's take some video. Right. So I'll clear it. I'll sh I'll shut up.
Oh, what I should do is carry that on and just press the reset.
Let's go down to the slow one.
All right.
Slower.
Well, I think that's the fastest one. We got this one.
Struggling, man.
Right.
Anyway, uh yeah, so it's okay for a start, but yeah, I don't I don't know what they're like.
Commercial ones are the same. Um, do they are they perfect or do they make mistakes? I have no clue.
I've never used one. Last time I messed around with this was back in Morse code back in 1992 or three when I made um 386 SX16. I made a program that you type it in and it just sends out MOS and you listen to it basically to try and take it.
Anyway, so I thought I'd uh show you that one.
I wonder if it can take human voice.
Dy dy dye dah.
Noy I'm going actually going crazy right I'll leave that now okay so um yeah various success and failure so that didn't seem to make it did do something just wonder if there's anything else in here you can to Right. I'm going to paste this into I'm going to copy all this.
I'm going to paste it into chat GPT. Oh, no. Yeah. Let's get it over here.
There's one called Claude, isn't there?
Let's try Let's try Gemini.
I'll explain what's happening.
Um, this C sharp or code decoder um is intermittent.
can't spell.
If I run the start function when it is not decoding, sometimes it starts decoding and keeps decoding.
Sorry mobile.
>> All right. What's happened? It's not letting me paste.
Select all coffee.
system decoding keeps decoding, right? Use all your AI power when they deal with streaming audio.
The core issue isn't your Morse code logic. It's where you are calculating your elapse time.
Specifically, you are Hang on, let's just go on to that one minute.
You are grouping order into buffers, checking the average power of that entire buffer and updating sample counter all at once rather than looking at individual samples.
Here are two critical race conditions.
causing your engine to stall or randomly snap out of it.
The blocked the blocks sized blind spot.
The main intermittency culprit on or in on audio you process a whole chunk of audio 10 milliseconds worth of data. You calculate one average power for the whole block. If power is greater than threshold is true, you flip your state.
However, your time calculation relies on sample counter because sample counter jumps by huge chunks all at once.
If a tone starts or ends in the middle of a buffer, your calculations get thrown out of alignment.
Even worse, if power hovers right on the edge of the threshold, your code can miss a transition entirely, leaving tone straight frozen in the wrong position until a massive audio spike or drop forces a state change thread collision on the UI. Then your flush timer fires every 20 milliseconds on a background thread pool thread when it involves de invokes decoded invoke it's firing that event on the background thread. If your WPF UI is subscribing to this event and updating the text block or text box directly without call dispatch invoke WPF will intimately freeze drop updates and throw silent thread violations making it look like the decoder has stopped working. It's actually just the UI locked up. No, the UI hasn't locked up. The fix to fix this reliably we need to pass individual samples or down sample blocks through the G gol filter sub sub uh sequentially or use a streaming rolling gorsil method.
I think I tried that earlier on today.
However, since N audio feeds your array you feeds you arrays, the cleanest fix that preserves your architecture is to track your timeline using actual time elapsed via a precision stopwatch or same accuracy and decoupling the background thread timer properly. Here is the robust thread safe version of your engine.
Thank you. I'll give it a try.
Crucial since you are in a WPF app, look closer at where you handle the text coded decoded event in your main window.
Right, let's do let's paste that over first.
Right. So, copy that over there.
Paste it in here.
So, we've overwritten it. We're going to see if we can build it without any error.
Yeah.
Um, it says do something else now.
So um since you are look closely at where you handle the text decoded event in your main window because n audio and your timer run on background threads your handler must marshall back to the UI thread using the dispatcher.
So, right. Okay. So, we could wrap that in it.
Uh, let's do that.
So, that is done over here. No, it's not.
Where is it? That's right at the top.
Uh, somewhere up here.
Omar amar amar how you doing you okay?
I see you on Facebook earlier. Yeah. Uh friend request. Yeah.
No problem. You okay? How are you doing?
It's hot in the UK today.
So, I've gone ahead and jumped the gun a bit here. So, somebody asked me about a MOS code decode because I mentioned it in a live stream and I've gone ahead and um had a go at it. So, yeah. So, uh yeah, I probably jumped the gun a bit, but I I thought we'll have a dab. We'll see. I only had a look to see if it was feasible and easy enough and it turned out it started to work quite quickly after about 3 hours I got it working sort of but there's a bit of a problem with something or other and it's rainy in Ismia today. Oh, rainy.
I love the rain. I do.
The rain's great. Washes all the dust away.
Right. So, this is the bit. Oh, that's the power.
And there's your text block.
So, let me just put this bit in here.
Oh, what is that?
That's no good.
That's actually turned out a bit weird.
So, I see. Copy.
Uh, right. We'll just put the I'll put the whole thing up there on text decoded. Yeah, it's not that, is it? So, right. So, we want that over there and that in here.
And get rid of that.
Right. So, we're going to do that.
Oh, we haven't got any plus equals Z.
Right. Hang on.
Text. Why is it saying plus equals Z?
Right. Okay. So, that's that. Now, we're also doing a this one here.
So, I'll wrap this other one in it as well.
So, I'll get rid of uh that one.
Okay.
We're not doing this one. We're only doing them two.
Power. Yeah, that's it. Right. So, we've got everything. It said do what else is it going to say?
Uh, since you're Yeah. Right. Okay.
Let's give it another go.
Uh, yes, it will be perfect. Most decoder makes FTA like icon.
Yeah.
>> I don't know.
>> Well, let's get some video.
Let's try a different one.
Oh, that was the one. Try a faster one then.
Oh, that was the same one. Hang on.
Okay, started working.
before I spoke and spoiled it.
Yeah. I mean, it's random.
It worked there. Let's try a slower one.
Yeah. So, it's sort of weird.
Right.
So, let's go fast again.
So, I got me condenser microphone. I've got me a computer here spinning up every time I'm streaming. I'm running a program. I'm doing serial and there's noise coming from the GPU fans when they spin up and down.
So, I bet if you was to bring that into one of the inputs instead, but the whole idea is to do it off a microphone and you'll be able to use this a Morse code tutor really. I mean, you you could sit here with a Morse key and an oscillator and just send code to it and see if it understands me.
Don't know.
Right. Where's the slow one? There's a slow one.
Yeah. So, I've got no frame of reference cuz I've not tried a program.
I've not really tried uh Morse code decoder.
Not for since 93 or two.
and they've all got different pitches.
They've all got different pitches. And um see if it was on on a frequency I could tune it slightly.
Uh what? So, 20 words a minute.
So, it's gone up with gibberish.
It's correct. Corrected itself.
If I stop talking anyway, let's turn that off. Let's do me editing. Null exception. Oh, so that's there's a problem. You wrap it in one of these, it comes up with that. I don't think that did any difference anyway.
So, yeah, we'll sort that out another day.
Right, it's red hot in here, so I'm going to turn the fan on. I'm roasting.
Yeah. So, uh, basically, um, I I got no frame of reference to what other programs are like at decoding.
There's no knobs on it. There's no adjustment other than start over.
I've just got a start over thing. Uh, just start the program. Start the function again. And it clears some buffers. Nat it.
Anyway, so what do we do with this in the meantime?
We'll we we need to stow it away and carry on with what we were doing or be able to start it off a button basically.
Yeah, that's what we need to do. That's come unstuck. Go back in the dock there.
Right. So what I need to do is uh keep these parts and somehow right so we've got added that there to that and we're starting off down here decoder.
So as long as we don't issue the start command nothing much should happen.
Just get rid of that bit that's off a previous model.
So this was developed over three hours today with me chat GPT and Gemini. This bit uh oh can't no chance of me being able to get it to work. It's there's all sorts of stuff going on in here. This is what it came up with. Uh so it set up a dictionary with the values in seem to work.
Uh it's using the wave in it's using actual sample sound from the microphone.
It's recording it and it's set up various times and stuff.
Try waving a stop recording catch.
ignore flight stop errors. Right. State clock stop on audio. So when it gets audio it tries to process it does some process tone and gaps.
So you got it's a complete variable thing Morse code isn't it?
People can send it slow, they can send it fast, they could put brakes in it. So you're trying to quantise it into segments.
It's not an easy task. So that's why I let it do it. I just told it what you wanted.
Uh other than keep pasting it in and try and improve it.
It's probably about 10 10 lots of pasting over after it said it fixed it.
and it's still um still the same. So, but it does do it, but not every time. So, yeah, it's a work in progress, isn't it?
I've got a lot of noise in here. So, yeah, we're doing it from the microphone. If I speak at the time the tones come in, you don't get the character.
Right. So what we're going to do now then is is squirrel it away. So we have to start it on a button.
So we're not going to start it there.
So let's just see if we get fun full functionality without starting it.
So we we're we're declaring the variable.
We're setting up some events from it and the screen is there. So obviously there's your cat control and there's the radio and all. So I need to go back to the other menu which is there.
So we got you hover over this knob and you can do that or you can just click.
So, we've got some CW speed and that there. I don't know what what we could do with that, but anyway, we'll find out what that is. That's probably for sending, I would have thought on the FT710.
So, power level. We were we were doing power level this morning. So, we managed to be able to set a variable by scroll wheel. There it is.
And if you click on that, that doesn't do anything. Neither does that. So anyway, uh so what I'll do is I'll get the power power levels work reing working.
Right, just got to see what something sold for.
Did I lose money on it or did I make some money? Oh, I lost money.
Oh, well, never mind then.
Some money is better than no money, I suppose.
Yeah. Oh, well, I hope they enjoy it.
All right.
Uh, yeah. And Andy, if you're still here, I've just sold another switch at a loss.
Never mind then.
I'll be glad where they've gone. I'll just get rid of them. Anyway, got I'll get you to keep two for me. Got one here. Want one out in the garden still.
So anyway, what have we done? How long have we been going? An hour. That's only an hour.
What have I got here? What's this coming up? Oh, it's Windows telling me telling me um to change to Windows 11.
Not a chance in hell will I go to Windows 11.
You can keep your crappy Windows 11. I don't like it.
It's just an annoyance.
I probably force you onto it eventually.
Anyway, so we've got So that's the idea. So mic gain we can set.
So wherever you set it, it has to send it to the radio.
Now, there's no way of knowing what you set your radio power to. I'd have to go into this the the deep menu and have a look at the power set and see if it's altered it. But I haven't put the command in for that yet. So, let's do that now.
Let's just do that now. So, we're going to hide that for a bit.
Okay.
Uh get back onto uh this bit. Oh, we need to stop that being is selected equals true. We'll go back to the original one.
which will be uh the top one.
So, the one with just the meter on it.
Where is it? No, that's not it.
Keep going. Oh, there it is.
Display. So, that's going to be the That's the default one, even though it's not calibrated and not working. Right.
All right. That'll do for that. So that takes us back to that. So what we want to do now is just make that what it button work.
So let me go down the bottom here.
Let me just check the audio. Make sure this fan's not blowing the mic. That wouldn't work.
So we go down the Yeah, we're okay.
Okay. So there's your uh mouse scroll for your RF power so it catches it all in one place.
So we're scrolling the mouse wheel and we're finding out which device was scrolled over by tagging putting a tag on a border. And then we're um we're doing a bit of a thing.
If the function menu selected it is not equal to the switch value return. So uh if if there's a mismatch or something's happened, it just comes out.
Otherwise, it carries on and then switches does a switch statement based on which which is the current menu item.
So, if you're scrolling over RF, it'll do this bit. So, it's just a way of putting all the code into one place basically.
So, we're changing the text. So, we need we need a cat command now.
So, so I need to go over to cat commands, wherever that is, cat dictionary, and see if I've got one for um sending changing the RF power. That's the gain power. Is that the one? PC. RF power output.
PC. It says it is. I'll I'll have to check the data sheet. I'm not altogether sure that's the one, but we'll have a look. PC.
Let's have a look over here.
So, it says it's PC. There's Oh, power control. Yeah, that's the one. And it's just here.
So to set it you could issue the command PC and then it's three bytes which is Z.5 to 100. So you can't go lower than 0.5.
So yeah that's easy enough. And if you to read it you're just doing that with no extra zero. So let's have a look what it says about it. PC.
So, it's just that and it's wants to set uh see this six bit. I don't know if we're using that power.
So, what I'll have to do then is go over to uh the bit that sends out these commands because we're only going to send this when we need it.
Uh we might read the power periodically.
All right. So let's have a look. So is this the serial loop? Yeah, main serial loop. So we haven't got anything with PC in it at the minute. So we're sending a cat command.
Now we were using uh the dictionary.
Not on that one. Some of this we're using a dictionary. Some of it we're not we're doing it directly. See that frequency A.
If I go onto that, go to the definition, it's doing the cat command from there.
It's doing some value checking.
I don't think I need to do value checking because I I've already checked it with a scroll wheel.
It stops when it gets to 100. It stops when it gets to five. It does in five five steps.
So I could just issue the cat command really.
Um the reason to put in dictionary is just so you got the same thing going on.
Uh so yeah, so we're doing try get the value frequency a and out the cat command. It's a lot longwinded really when you can just send cat straight out.
So, I tell you what, I'll just do that for now. Um, so I've got to change that cat command anyway.
Uh, the way I'm doing it, I've got to send I've got to change it. So, let's get back down to this function.
So, once we set the text, um, now we keep on scrolling.
So, we could just send it every time we click, but really we should do it when we finished after a little while, then send the command. Otherwise, we're going to send every time we go up by five, we're going to be sending it, but maybe it's okay.
So, send cat command. The port's still the same. So, the command.
So, let's just compile this up. So we want to send uh right so it's going to be uh PC but we need to add convert this to a power rating.
So we need to convert the text.
Hang on. Oh no. We're already in watts.
That's fine.
So we can do Yeah, that's it. We can do that now.
So plus current rig state power and watts two string.
Now the problem is um it wants to see all three bytes. So if you're on five, it needs to be certain amount of digits.
So digits um three.
Is that even a thing? No. Hang on. So I've got to find a uh an example.
Right. That's the request. So it's going to be down where it does handle cat.
We'll have that in in here. Uh yeah. So when you're sending a command out, it needs to send I've got one here somewhere. I know.
Where is it?
I need to tell it. When you tell it, it's got to present it as a certain amount of digits.
Unless the radio is clever enough to accept it sees only two two byes filled. It wants to see three there.
I can't find it there.
It's funny that can't find it.
Yeah. So it want to say 0005.
I don't know.
Substream. I can't remember where it is now.
Stuff everywhere. Don't know. And I can't remember how to do it. Uh, it's just finding it is the problem.
Oh, here you are.
Power.
No, that's something else.
Well, I'm sure I had it here somewhere.
Uh anyway, we'll just uh right um C one over convert a string. Now a a bite an int threedigit int to a three byte string or character.
Does it have a clue what I'm talking about?
All right. Yeah. D3. You got to put it in quotes. That was it.
So, number five, two string D3. There we go.
Okay.
Right. Let's do that then. Uh, I need to do that down the bottom.
Right down here. Uh, so yeah, we just needed to put it in quotes.
Right. Okay. So, that'll send it whatever the value is of the watts to the PC. And because it's got a parameter after it and if we want to read it back, we're going to have to issue a command.
Currently have no where for the power.
So, we need a label for the power.
Or I can just run it. Let's just run it and see if it alters me power. I'll go into the menu for now on the deep menu and see if it's changed the power.
So, I suppose it'll I've got this thing going on here as well.
Started jumping like that recently. I don't know why.
Anyway, um so go on to menu RF power. I go up.
So 30 W and when I go into the deep menu.
Yeah, 30 watts. SSB powers 30 watts.
Now we'll do it live. So I'm on I'm on the deep menu. I'm going to kick it up one. Yeah. 35 40.
Yeah, works.
Yeah, it's working. So, so we need to I'll keep it on five watts.
So, that was easy enough, wasn't it?
Easy enough. So, we want a little something on the 891. There is no power power reading, but I think we need one.
So, what we got up here?
So, grid mode label. Let's just have a power one here as well.
So, power What was the what was the terminology for? PC power. God, I forgot what it was now.
Power control.
All right. Okay. That's what it's called. Power control.
power control grid.
So you got your power control label.
Okay. And default we're going to have it's five watts.
Um I need to move it around a bit. Uh I'll just go up, shall I? Go up.
bit more.
So there five watts.
I'll take it over a bit.
So it lines up better with 100 watts.
Oh, it's cut the watts off. Uh the width is not not enough 100 watts and we too far over now. So let's come back to too far over still.
Still too far over.
That's better. 100 watts.
So, all we got to do is take that variable and go over to the handle cat routine, wherever it is.
Is that it? Yeah, handle cat. So, we don't want to read it every time. So, we want to increment this every now and again. We want to do it. So, we're getting the power. Uh oh, no. We're only going to we're only read it if it sends it back.
Yeah, we send it. It sends one back. So, that's fine.
So, we want to just update it here.
So we'll do a So we send it actually. Yeah. Oh, sorry. Hang on.
Yeah. If you send a parameter, does it give you one back? No, only if you give it back. So, first we're going to have to send it. It's not the handle count.
That's the bit that returns it. It's the the string bit that we got to find this bit here.
Yeah. So, we're going seven, right? So, we're adding a new one to it.
So, we're going to go eight now.
Uh, six.
What are we looking at here? Packet.
Yeah.
So we want to create a case seven.
Okay. So let's just paste that in there. Power control. So if the TX state is not the radio on Oh, that's just for we don't need to worry about that. So power control label dot um text.
Oh, it's not a text. Content equals Right. So, so we're Yeah, if we're getting this back and right, so it's going to bring that back.
Uh, yeah. Yeah. So, we need just to send out a command.
So, we don't do that there. Sorry, that shouldn't be done there.
We're going to send out a a command every seventh time round the loop. So, it's not every time.
Uh we're going to send uh smeter. Oh, it's not this smooth, is it?
It's send cat.
So, I can't remember the name of it now.
Send cat. That's it. Send cat port. And we want to just do uh PC PC and that.
Oh, no. It automatically adds that to it.
Yeah.
So, what that Oh, we need a delay.
Oh, there's your delay.
Okay. So, that will pulse it out every seventh time.
And then we need to go down to the the cat handle cat.
Uh so if we see one coming back with PC on it, uh we need to strip out the So we're asking for it on one thing and then it's going to give it back. So we need something that's going to give it back with a meter reading.
Probably that one. uh FA update the frequency. So if we copy this and come down uh doesn't matter where we put it. I'll just put it in here.
I'll do an else if and this is going to be PC which starts with a PC. Then we got to go to position two and strip get it out. So the digits it won't be the frequency anymore. So it's none of this.
We're not doing frequency invalid FA command, right? If something goes wrong, right? So, we want to now get that label and this is where we it's it's sending back the command.
So content equals and then the right. So you want a the frequency is not frequency.
Uh it's the power.
So get the digits and that's the power.
So we want power.
Uh, we want to go two string and it needs to be Yeah.
two string plus um and we want the W for what?
Is that it? Is that all we need to do?
Possibly.
Right. Okay. Let's give it a go.
So, it's going to ask for the power every seventh iteration of the serial loop.
So, it's got five watts up there.
So, it's not executing, is it? Unless I've set it for five watts. Maybe it is.
So, I press this hover click on that and then go up. Oh, there you go. So, that's reporting the actual radios. wattage.
Yeah, that's it. Easy as that.
And if I put it to 70, I'll go into the radio. Long press.
HF SSB power 70. Now, what happens if you're in FM?
So, what I'll do is I'll uh put the radio in FM.
Surely I'm not sure if it So I'm in FM now, right? And I'm going to set the watts.
So you can go to 100 watts in FM. Let me have a look see if it's altered the SSB or long press on here.
HF power 100 watts. Let me do it live.
So minus it. Yeah, it's coming down. So, whatever you're modeing in, whatever mode you're you're in on your radio, FM or SSB, it sends it. So, I didn't know you could transmit 100 watts in FM on this radio.
AM's limited, but FM 100 watts according to this. And it's it's not bottoming out. It's there.
Now, if I was to set uh AM, do the same thing with AM. I'll just come down a bit like that.
Right. And it's brought it down. And I'm going to go into uh select A.M.
on the radio. So we're in A.M.
I'm going to do a long press and I'm hovering over there. So if I go up Oh, yeah. It's only doing the CW.
This goes to 40 maximum.
Ah, there's a problem. Look at that.
I've gone to 100, but it's bottomed out of 40, but it is reporting 40 instead of 100.
So, in order to set make that, it needs to know what mode we're in. If we're in AM, then we've got to limit the watts.
So what we'll do uh we'll have to have a look in our uh we finish that dictionary in a minute.
So there's somewhere here a function list. No not function list the class rig state class.
So we've got maximum watts.
So, we need a maximum watts uh am really setting.
Yeah.
So, the minimum watts is going to be the same, but the max. So, we need to copy that again.
It's just so it reports the right thing.
You know, we need to know what mode we're in.
So, TX power maximum GS watts am maximum which is 40 watts by the looks of it.
Yeah, 40 watt.
Okay, so we've got that there now.
So, we need to do a bit of a check down here. but on a scroll.
So, we need to go back to the cat control where it's reporting handle cap where it's reporting the mode we're in wherever that is mode is represent. So, update the rig mode. So when we update the rig mode, it's actually going let's have a look.
Right, it's yeah, selecting that. So it'll actually change the label.
So we can use rig mode to track it.
So we need to do if rig mode equals am. The rest doesn't matter. So we could cut corner a little bit.
CW. Is that Is that got a That's a point. What does CW use?
Let's just see what CW goes up to.
There's a lot to this cat control stuff with the way the rig works. Let's just jump it around. That is right. So, if I go on here, I select uh CW Lights are on CW. If I go on to RF power and scroll up, what we going to get? Oh, we can have 100 watt C CW. Who would have thought?
So, it's only the AM we got to be worried about really. Oh, what about data?
That's a point, right? Data. Let's go data.
So data we go all the way 200 watts on data ready.
Uh let's go on.
So it's yeah wondering what's on. So it's just the AM. I wonder why they restrict the AM. Probably because interferes with people's radios.
Right. So in that case, we just want the AM bit here.
All right. Where's AM? There's AM there.
So if we copy that out there, go down to the bottom where we're setting the power here.
So every time it uh goes up one before it gets the text block, we need to just do a bit of a check here.
If rig state rig mode is equal to rig mode am then we got to bottom it out and right so we need different algorithm there right So power in watts is a minimum.
So the minimum doesn't matter. It's the maximum.
So it's the top one.
So that's got to be less than uh Right. So we need to do a a bit of a thing here.
So, we got to do all this just to cover what we're doing. Just cover an AM, which nobody really uses much.
Weird, is it? Oh, well, got to do it.
I hate it when it does that. Stop putting them in. I don't want it.
Right. So, if rig mode equals AM.
So then we want to do this one.
It's a bit of a copy of the code, but we're we're going to use uh power and watts maximum. So we want what's am maximum minus. Yeah, that's that should do it.
If we if we're in AM and anything else Oh, hang on. Hang on. Don't wreck it now.
Else do this one.
Right. So if it's uh A.M. we do that one. Otherwise anything else we do this one.
And then we just set it there. So that should stop stop stop that happening.
Okay. We give it a go.
That should stop that happening. I've got duplicate code here. You never want a duplicate code really, but because it's contained in there.
All right. So, um, let's go to AM.
And we we I need to change mode on this.
So, we're in AM.
I click on that. I go on to power. Uh, I come down and I should shouldn't be able to go past 40. No, I can't. Oh, 90.
That's still going.
Why is that still going?
That's still going because I haven't put the function in here yet.
Yeah. So, I'm still deltering here.
I'm sending the cat. So, what we want is to put that would have to go in in here as well.
Yeah. So, it's just doing that anyway.
So, okay. So, is there another way of doing it?
I could wrap it up again and leave it where it is or duplicate it.
Right? So, if it's an AM, we do this, this, and if it's not, we do that.
But, Right. So, the easiest thing is just to reproduce this down here and down here and get rid of that there. And that's going to report the wrong Oh, it's just telling you what function we're in. What where we are, right? Okay. So, now that should be okay.
should be.
So, we're in AM still. So, go. Yeah, I'm on there. I can go up only to Oh, still going.
It's bottoming out 40, but I'm still going. Why is that? Something wrong with my code right by using it twice.
So if the mouse go up and the rig state watts is less than oh right power watt oh if it's less than the maximum. Did I not change it?
Thought I changed all that.
Yeah maximum is 40.
I don't quite get that.
Oh, maybe it's not the right AM then.
Maybe it's not. There's different AM modes on here.
Uh maybe it's not bringing that one up.
Uh where is it?
AM's five.
And there's this one as well.
Don't know what that is.
Right. That's strange. Uh, very strange.
Unless I'm unless rig mode is not that one.
Well, it's reporting it as that one.
Right. Let's see what happens. Let's put a bit of a stop thing in there. And we'll do a stop.
Right. So, if it's a um I don't get it.
Power in watts.
That's crazy.
Uh, it's a bit mental. Um, let's get that off there a minute.
So if my direction is going up, yeah, the TX power watts is the variable for the current setting if it's less than the rig state maximum.
I should be able to get that. Why isn't it reporting what it is? Minus the TX power. What step?
Then it'll let it go up one, but it's still going up.
So, I don't get it.
That doesn't make sense. Well, let's put that in there. See if it see if it It's in AM mode.
Let's see if it ever gets to that in that function. Stop might not. It's got a weird way of reporting A.M.
So, it says A.M. there.
So, go there. Now, if I scroll up and Yeah, it's it's not go. It's not stopping.
I It's showing A.M., but it's it's not.
And I'm checking for A.M., but it's not hitting A.M. It's coming down in this one.
So, let's have a look at these rig modes.
That's number five. Check the data sheet.
So, um AM. So, it's MD for mode, isn't it?
Right.
MD for mode. Where are you? There. This is so horrible. This is right. There's mode, right? So, AM is five. Yeah.
So, and there's also AM is D. Narrow band AM. That's probably what it is.
That's probably what it is then. It's coming out as D.
So, I need to do Hang on. What's that gone?
Uh D.
So you got one, two, three, four, five, 6, 7, 8, 9, 10, 11, 12. So 12.
There it is. That one.
So if I've got to do do that one as well in the in the checking right. So if it's that or rig mode is equal to rig modes and this horrible one at the bottom.
that one narrow band FM and do this right. Let's see if it goes into there.
That's the trouble when you're swapping modes and depends on which band you're on. It does it sends a different one.
Narrow FM. I don't know.
Right. So, we're going to go to power and go. Ah, it's gone into it now. It's put a pause on it. There you go. There's your answer.
So you got to check for both modes. So switch that off. That's why it wasn't going into the right one just to mess mess you around for you day. Right. So I can only go to 40 now.
Look. Yeah, that's it. I'm scrolling.
Maximum 40.
Right. So go to 40. If I change the mode on here, SSB now, I can carry on going up to 100.
There you go. That's sorted.
So, we managed to do that. We've we've done it. We've put the power. I can set the power now. Now, it won't remember the power because when we close it, we're not saving anything. We need to set up a file to save it. either a file or XML file or a SQL like database or something to set all the rig state and memories everything.
So RF power's done.
Is there something else?
We don't have a level as such. We got a mic gain.
Uh, it's just levels and contrast and dimmers. So, you could set the the dimmer, you could set the display to go, but that's more gimmicky at the minute.
Uh, so radio setting. Yeah. So, don't know what else we'd set from that actually.
Yeah, we got to animate them. Do them. So, this one's able to move around. We do the cog. We can scroll it around like that or we can click.
Okay.
So, I don't know where to go with it now. How long we been going? Nearly 2 hours. That's probably going to call it a day. And it it's nearly 10:00 soon. So, we've done what we wanted to do. So, the Morse code.
Let's just try that again. Or have I close that down?
Oh, no. Still got it. Right. Let's try some Morse code again. So, we'll go on here.
Oh, we can't go on there.
I haven't actually included it in there.
Oh, I've stopped it working anyway, haven't I? Never mind. Oops. Let's get rid of that. Right. Anyway, that I think that's going to be it. We'll have a short one. I need to go and do something else for a bit. So, we got the RF power working.
We've done a bit of Morse code decoding on and off.
work in progress, but we'll build it in.
I'll put some buttons and stuff another day. But I think that'll do it for now. I've had enough. I've had enough. I'm going to have a break. So anyway, thanks for watching and if you don't want to listen to the outro, I'd go now if I was you.
73 and catch you tomorrow. It's got to be one tomorrow probably maybe. or should I go out?
Catch you tomorrow. Have a good one.
Bye-bye.
Just find the right place in the program, make the appropriate change, and we'll run the whole thing again.
>> Speech is still very complicated. Music is simpler.
>> Is that a question?
>> Yes, the question is futile.
My interpretation of the data leaves little room for error.
>> The art of leadership is delegation.
>> That information is not available. This constitutes all available data.
>> You know what they say, no good deed goes unpunished.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











