On Sun, Jun 18, 2017 at 11:47 PM, Jack Purdum via Groups.Io <econjack@...> wrote:
Joe:
Go to line 398 which reads:
? tft.setTextSize(defaultTextSize);
? g_identifier = 0x154;
and add the yellow line and see what happens to the message.
Jack, W8TEE
From: Joe <joeman2116@...> To:[email protected] Sent: Sunday, June 18, 2017 7:26 PM Subject: Re: [BITX20] BITX40 TFT DISPLAY CODE - Coding A Control Button - Looking for Assistance to figure out why a Step Tuning button does not work
Jack,?
After changing:
?text size in line 302,340,376 ?the sw1, sw2, sw3 ?now look good - right place right size.
text size in line 850 was a 4 now a 3 - frequency correct size and fits perfect.
The next one is the meter size its to wide ?when comparing it to your good display. ?---- looked where to change value ?but could not find to make it narrower.
Your good display only goes as wide as the w in sw2.
The msg is till not in correct place - did not find a location where to force it lower
Getting closer........
Joe
VE1BWV
On Sun, Jun 18, 2017 at 1:53 PM, Jack Purdum via Groups.Io <econjack@...> wrote:
Hi Joe:
It appears that there are two issues: 1) The font size, and 2) the cursor addressing. If I recall correctly, both of those issues are determined by the Adafruit_GFX library, which the mcufriend library inherits from. Try first setting the setFont() calls to the smallest size (1) and see what it looks like. Then play around with the setCursor() calls to see how that impacts it. Only make one change at a time, recompile/upload so you can assess the impact of that one change. Let me know what you find out.
Jack. W9TEE
From: Joe <joeman2116@...> To:[email protected] Sent: Sunday, June 18, 2017 12:36 PM Subject: Re: [BITX20] BITX40 TFT DISPLAY CODE - Coding A Control Button - Looking for Assistance to figure out why a Step Tuning button does not work
Jack,
Thanks for talking time off your busy schedule to look at this code.
I ?liked the the PD8W display, ?but it now appears more obvious the code is poorly structured and therefore a nightmare for someone like me trying to work out the issues.
I ?looked at you suggested changes and they make sense - and reduce code
Unfortunately it induced other errors which I could not get around.
Hmmm,
I ?am thinking if Jack is finding it difficult to read then I am in big trouble .....
I believe, its probably best to work with your code, which is supported and as you made clear, ?more organized / ?logical.
I have your board completed and just waiting for a mini_360 vr, the chokes and the 78L08.
My progress:
I have loaded your code and the display comes on .?
V: is hovering around 4.5 - so it appears alive
I also plugged the tft into a regular atmega2560 for testing / playing..
I am using an 2.8tft. 0x1289
Compared to the picture in your manual, I see this:
?mesg appears halfway up the screen and the bottom of the meter is about ?1/2 inches from the bottom of the screen.
Any suggestions where the issue be?
Thanks Joe
VE1BWV
On Sat, Jun 17, 2017 at 11:18 PM, Jack Purdum via Groups.Io <econjack@...> wrote:
Man, that code is really hard to read. Evidently he doesn't believe in functions. Anyway, look at the code where the encode switch is read. If a switch push is sensed, the code does nothing. At least try this:
??if ( digitalRead(ROT_SW1_PIN) ) {
Serial.print("in digitalRead(), mode = ");
Serial.println(mode);
? ? ????//delay(30);
? ? ????while (digitalRead(ROT_SW1_PIN)) {
? ? ????? delay(1);
? ? ????}
? ????? mode++;
? ? ????mode %= 5; ? ?// What the hell is the purpose of this if you only use 3 increment states???
? }
And take this code:
? if (oldMode != mode) {
? ? oldMode = mode;
? ? switch (mode) {
? ? ? // ? ? ? ?case 1:
? ? ? // ? ? ? ? ?Serial.println("1 Hz");
? ? ? // ? ? ? ? ?break;
? ? ? case 0:
? ? ? ? Serial.println("100 Hz");
? ? ? ? ROT_d = 100;
? ? ? ? tft.fillRect(195, 154, 50, 10, BLACK); ? ?// Handle these differences in the function as offsets based on mode
and change the big switch/case above with the function call. If special formatting is needed, that can be done in the function.
Jack, W8TEE
From: Joe <joeman2116@...> To:[email protected] Sent: Saturday, June 17, 2017 4:17 PM Subject: [BITX20] BITX40 TFT DISPLAY CODE - Coding A Control Button - Looking for Assistance to figure out why a Step Tuning button does not work
Hi All,
While waiting for some parts for another project, I came across some interesting code and have been doing some work on existing code by PD8W. I have tried to contact him for some help but he does not appear to be available. He developed some code to add a 2.8inch tft to the bitx40.? The display is interesting and uses a rotary with the sg5351 with an atmega2560.
I have made Progress:
The display works fine. The Vfo dial changes the sg5351 dds When i disconnect the current raduino board and the vfo connector on my bit40, then connect my test unit, I can tune fine, no clicks or noise , reception is great.
Problem: - push buttons?
The code uses the switch on the rotary or a standard push button to change the range step ?tuning (10khz,1khz,100hz etc etc. It uses pin 46 (atmega 2560) but I tried it on other pins as well. I cant seem to make the button work. If i hold the wire which is connected to the pin, the range starts changing(capacitive effect I guess) ?but If i try a button it does not change the step tuning. I have tried using _pullup command - no change. Also tried 10k pullup resistor (pin to resistor to 5v) - no change. Tried 10k to ground - no change. Tried direct - to pin to button -? Also tried other push buttons to make sure they were good.
This should be simple but I am running out of ideas.
If any one can provide a solution or some ideas to try, for this one button , it will probably solve the same issues with the remaining buttons . Any help would be much appreciated
Joe VE1BWV
?
#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include <Fonts/FreeSansBold12pt7b.h>
#include <Fonts/FreeSerifBold12pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <MCUFRIEND_kbv.h>
#include <Wire.h>
#include <Rotary.h>
#include <si5351.h>
?
#define ?ROT_L1_PIN 49// rotary A
#define ?ROT_R1_PIN 48//rotaryA
#define ?LED_R_PIN 45
#define ?LED_G_PIN 44
#define ?LED_B_PIN 47
#define ROT_SW1_PIN 46// ? <<<<<<< this is the step range tuning button >>>>>>>>>>>