Overwrite data on a 3.5"screen with a Mega

Hello ,

In my sketch , I try to overwrite ( clear ) data in "Adjust" line 11 to 83 .
This data is a voltage comming from the middle contact of a pot-meter. ( reading between 0 and 5V or between 0 and 1023 digital ).
When I move the adjustable wiper sloowly , the sketch is working just fine . On the other hand , when I move the adjustable wiper quickly the green dots ( earlier possition ) remains on the screen .( they are not corrected )
Do someone have any idea what I did wrong ?
Marco , France

Adjust.h (13.1 KB)

directions.h (3.62 KB)

loop.h (3.88 KB)

ROTATOR_jan25a.ino (5.57 KB)

I looked at your ino file. In the Adjust() function, you #include Adjust.h which contains executable code.

Executable code goes in cpp files, not h files.

You should have multiple ino files, or external cpp and h files, rather than the mess you have.

In Adjust.h, you have multiple statements on one line. You have macros that are defined somewhere else.

Youhavefartoolittlewhitespaceformetomakesenseofthecode.

I don't see anything that draws green dots, or that erases anything.

So, no, I can't see what you did wrong.

#define R tft.fillCircle(X1,Y1,3,RED); // Draw the movement of the direction with a RED CIRCLE
#define G tft.fillCircle(X1,Y1,3,GREEN); // Draw the movement of the direction with a GREEN CIRCLE

This are the green and red spots.

Sorry If I make beginners faults in the mess I wrote.

This are the green and red spots.

So, where do you erase them? Or "undraw" them by creating a "spot" of the background color in the same location?

I saw the multiple #define and removed them . I forgot to do that before but it doesn't change any thing at all .
Marco

So, you stopped doing something useless, and nothing changed. Color me surprised.

How about you learn to answer the questions posted.

You did not ask me a question , I don't see any question mark .
I know my english is very bad but I can't see any questions.
And by the way , I didn't mean that " stopping doing something useless......" I meaned that multiple #def.... changed the results at all .

And belittle people will not help them to move on .

Thanks , Marco , France

F8VOA:
You did not ask me a question , I don't see any question mark .

Look at reply #3 again.

Stop laying into people like you do. You seem like you want to be helpful, but the way you go about it, and your high and mighty attitude, kind of stinks.

This is just a guess but if it works ok going slowly then doesn't spinning the pot quickly, then you are outperforming the code execution speed. It then needs to catch up with the new reading.

So you are looking for where the pot read is and it should update in the loop quickly.

Your code is confusing but I suspect it isn't yours as I think I've seen this on the net. Certainly there is code for a Ham rotator written by a Russian ham somewhere on the net.

73

Thank you Tasmod and Steve.

This code is intirely mine ( no russian or others- no copy , no stolen code ) . I have a CDE HAM IV rotator ( 40 years now ) and like to make him a little bit more modern ).I know , the code could be much better , but this was only the first follow up of an earlier attempt ( code with a bitmap - world card as background ).

What I don't understand is why the graphics ( mariner's compass ) and not the print-out of the country code or the written mariner's compass code

let's presume : the antenna is in direction 5°
than :
D1==5 , on the graphic compass on the 5° position we will have a blinking dot ( green and red ) __DIR5;R;
on the 0° position , a light_blue dot DIR00;LB; , also on the 10° position DIR10;LB;
the cordinates for the position of those dot's are in directions.h

Turning the antenna to 10° will overwrite the 5° with a LB , the 10° with a R , the 15° with a LB .

And this every moment the antenna is rotating .

And that is why I don't understand the possibility to miss at some moment the overwriting.

I don't have sufficient experience in C or C++ .

Marco , France

Marco, it wasn't meant as an insult. It's just I had seen something similar on the net.

In my Radio folder I have rotator code from K3NG which was published in QST so maybe that confused me.

I have a lot on at the moment but will try to look at your code. Be aware that the refresh rate of some displays and libraries is woefully slow. Especially an mcufriend 3.5 display on a Mega. (Port pins not matching)

One thought when I glanced at your code, was change loop.h and Adjust.h to tabs and call loop.h another name which is more meaningful.

He Tasmod , no problem at all . I was glad reading your answer . I'm sure , I'm not the only one working on some code for a rotator . I'll have a look at the code of K3NG ( searching on the net ) , perhaps I'll find some helpful ideas .

Your are absolutely right about the 3.5" on a MEGA . Perhaps all will be better and easier when I rewrite(? some questions for David , the tft guru ) the code for a 3.5" screen on the right MEGA-pins (50,51,52,53......)

In the mean time I found a solution ( cheating but's OK for me now )

instead a RED and GREEN binking dot , I made a RED and LIGHT_BLUE blinking dot and because the background color is LIGHT_BLUE one can no longer visualize see the remaing dot ( cheating )

thanks for your efforts ,

Marco , F8VOA , France

Marco, I had a quick look. There are two R LB defines. One in the ini and one in Adjust

I'm trying to work through the logic in the first of the 'loop' ifs at the moment but I'm convinced it is to do with the display/Mega combination speed. I had the same problem with this combination trying to do a vfo. The rotary encoder could turn faster than the draw rate and so missed stuff. Another slow move of the encoder brought it back.

As you say one for the tft gurus.

Rob

He Rob , what's your call ?
Marco

G4NQX but not active at the moment as I've just moved home and have no antennas. Usually on 80 and 40.
I've 69 turns on the coil :slight_smile:
Rob

Hopely back soon on the air .
best 73 , F8VOA , Marco