Some interface improvements. The filter bars now work, and the characters for the filter values are now better. This also improves the performance of navigating the interface. Also, added a basic volume display.

This commit is contained in:
Michael Colton 2015-12-30 21:18:31 -07:00
parent 0d13c419cc
commit 3bdb147fdf
4 changed files with 241 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -31,3 +31,16 @@ extern const unsigned short bitmapWebSdrGradient[];
extern const unsigned short bitmapFilter[]; extern const unsigned short bitmapFilter[];
extern const unsigned short bitmapHadLogo[]; extern const unsigned short bitmapHadLogo[];
extern const unsigned short bitmapSMeter[]; extern const unsigned short bitmapSMeter[];
const unsigned short oneSmall[];
const unsigned short twoSmall[];
const unsigned short threeSmall[];
const unsigned short fourSmall[];
const unsigned short fiveSmall[];
const unsigned short sixSmall[];
const unsigned short sevenSmall[];
const unsigned short eightSmall[];
const unsigned short nineSmall[];
const unsigned short zeroSmall[];
const unsigned short hyphenSmall[];
const unsigned short tildeSmall[];

View file

@ -1,9 +1,15 @@
#include "images.h" #include "images.h"
//This site seems to generate output that is correct //This site seems to generate output that is correct
// http://www.henningkarlsen.com/electronics/t_imageconverter565.php //http://www.rinkydinkelectronics.com/t_imageconverter565.php
//BUT it will round down to the nearest 16 words, so you need to pad the image, and then delete the excess!! //BUT it will round down to the nearest 16 words, so you need to pad the image, and then delete the excess!!
//I don't remember what font I used. Something that was on my work computer,
//and I don't think there are too many extra fonts installed on it. I'll figure it out later.
//Looks like it's Aerial Black. The mode icon's are 9pt.
//Also, I wonder if I want to encode the height and width in the first two bytes or something? That seems like that's not a bad idea.
//86x20 //86x20
const const unsigned short psdrLogo[]={ const const unsigned short psdrLogo[]={
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0336, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0010 (16) pixels 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0336, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0010 (16) pixels
@ -752,3 +758,88 @@ const unsigned short bitmapSMeter[]={
0xFFFF, 0xFFFF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x05F0 (1520) pixels 0xFFFF, 0xFFFF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x05F0 (1520) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0600 (1536) pixels 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0600 (1536) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF}; 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF, 0x0000, 0xFFFF, 0xFFFF, 0x7BEF};
//8x9
const unsigned short oneSmall[] ={
0x0000, 0x0000, 0x0000, 0x0418, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0000, 0x0000, 0x863F, 0xFFFF, 0xFFFF, 0xFFF8, 0x8000, 0x0000, // 0x0010 (16) pixels
0x0010, 0xC7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0010, 0xC7FF, 0xC400, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000, // 0x0020 (32) pixels
0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000, // 0x0030 (48) pixels
0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000, // 0x0040 (64) pixels
0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0000};
const unsigned short twoSmall[] ={
0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0010 (16) pixels
0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, 0x0000, 0x0000, 0x0000, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xC400, // 0x0020 (32) pixels
0x0000, 0x0000, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFF14, 0x5000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFFF, 0xFE30, 0x0000, 0x0000, // 0x0030 (48) pixels
0x0000, 0x553C, 0xFFFF, 0xFFFF, 0xC400, 0x0000, 0x0000, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE52A, // 0x0040 (64) pixels
0x863F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE52A};
const unsigned short threeSmall[] ={
0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0010, 0xC7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, // 0x0010 (16) pixels
0x0418, 0xFFFF, 0xFFF8, 0x8000, 0x0418, 0xFFFF, 0xFFF8, 0x8000, 0x0000, 0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFF14, 0x5000, // 0x0020 (32) pixels
0x0000, 0x0000, 0x0000, 0x863F, 0xFFFF, 0xFFFC, 0xA2A0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0xC7FF, 0xFFFF, 0xC400, // 0x0030 (48) pixels
0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, 0x0010, 0xC7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0040 (64) pixels
0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, 0x0000};
const unsigned short fourSmall[] ={
0x0000, 0x0000, 0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFE30, 0x0000, 0x0000, 0x0000, 0x0000, 0x863F, 0xFFFF, 0xFFFF, 0xFE30, 0x0000, // 0x0010 (16) pixels
0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFE30, 0x0000, 0x0000, 0x0418, 0xFFFF, 0xFFF8, 0x8418, 0xFFFF, 0xFE30, 0x0000, // 0x0020 (32) pixels
0x0418, 0xFFFF, 0xFFFC, 0xA2A0, 0x0418, 0xFFFF, 0xFE30, 0x0000, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, // 0x0030 (48) pixels
0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x0000, 0x0000, 0x0000, 0x0000, 0x0418, 0xFFFF, 0xFE30, 0x0000, // 0x0040 (64) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0418, 0xFFFF, 0xFE30, 0x0000};
const unsigned short fiveSmall[] ={
0x0000, 0x863F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0010 (16) pixels
0x0010, 0xC7FF, 0xFFFC, 0xA2A0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0xC7FF, 0xFFFC, 0xE71F, 0xFFFF, 0xFFFF, 0xC400, 0x0000, // 0x0020 (32) pixels
0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, // 0x0030 (48) pixels
0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0040 (64) pixels
0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, 0x0000};
const unsigned short sixSmall[] ={
0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0010 (16) pixels
0x0418, 0xFFFF, 0xFFFF, 0xC400, 0x0000, 0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFFF8, 0xA53C, 0xFFFF, 0xFFFF, 0xC400, 0x0000, // 0x0020 (32) pixels
0x553C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, 0x553C, 0xFFFF, 0xFFFC, 0xA2A0, 0x000A, 0xA71F, 0xFFFF, 0xE52A, // 0x0030 (48) pixels
0x0418, 0xFFFF, 0xFFFC, 0xA2A0, 0x000A, 0xA71F, 0xFFFF, 0xE52A, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0040 (64) pixels
0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x0000};
const unsigned short sevenSmall[] ={
0x553C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE52A, 0x553C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE52A, // 0x0010 (16) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x553C, 0xFFFF, 0xFE30, 0x0000, 0x0000, 0x0000, 0x0000, 0x02B4, 0xE7FF, 0xFFF8, 0x8000, 0x0000, // 0x0020 (32) pixels
0x0000, 0x0000, 0x000A, 0xA71F, 0xFFFF, 0xE52A, 0x0000, 0x0000, 0x0000, 0x0000, 0x02B4, 0xE7FF, 0xFFF8, 0x8000, 0x0000, 0x0000, // 0x0030 (48) pixels
0x0000, 0x0000, 0x553C, 0xFFFF, 0xFF14, 0x5000, 0x0000, 0x0000, 0x0000, 0x000A, 0xA71F, 0xFFFF, 0xE52A, 0x0000, 0x0000, 0x0000, // 0x0040 (64) pixels
0x0000, 0x0010, 0xC7FF, 0xFFFF, 0xC400, 0x0000, 0x0000, 0x0000};
const unsigned short eightSmall[] ={
0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0010 (16) pixels
0x02B4, 0xE7FF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFC, 0xA2A0, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFE30, 0x0000, // 0x0020 (32) pixels
0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFF, 0xC400, // 0x0030 (48) pixels
0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xA2A0, // 0x0040 (64) pixels
0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x0000};
const unsigned short nineSmall[] ={
0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, // 0x0010 (16) pixels
0x553C, 0xFFFF, 0xFF14, 0x5000, 0x02B4, 0xE7FF, 0xFFFF, 0xC400, 0x553C, 0xFFFF, 0xFF14, 0x5000, 0x02B4, 0xE7FF, 0xFFFF, 0xE52A, // 0x0020 (32) pixels
0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE52A, 0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xC410, 0xC7FF, 0xFFFF, 0xE52A, // 0x0030 (48) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xC400, 0x02B4, 0xE7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, // 0x0040 (64) pixels
0x0000, 0x0418, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000};
const unsigned short zeroSmall[] ={
0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000, 0x0010, 0xC7FF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, // 0x0010 (16) pixels
0x0418, 0xFFFF, 0xFFFC, 0xA2A0, 0x02B4, 0xE7FF, 0xFFFF, 0xC400, 0x553C, 0xFFFF, 0xFF14, 0x5000, 0x0010, 0xC7FF, 0xFFFF, 0xE52A, // 0x0020 (32) pixels
0x553C, 0xFFFF, 0xFF14, 0x5000, 0x000A, 0xA71F, 0xFFFF, 0xE52A, 0x553C, 0xFFFF, 0xFFF8, 0x8000, 0x000A, 0xA71F, 0xFFFF, 0xE52A, // 0x0030 (48) pixels
0x0418, 0xFFFF, 0xFFFC, 0xA2A0, 0x02B4, 0xE7FF, 0xFFFF, 0xC400, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, // 0x0040 (64) pixels
0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000};
const unsigned short hyphenSmall[] ={
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0010 (16) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0020 (32) pixels
0x0000, 0x0000, 0xA71F, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000, 0x0000, 0x0000, 0xA71F, 0xFFFF, 0xFFFF, 0xFF14, 0x5000, 0x0000, // 0x0030 (48) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0040 (64) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
const unsigned short tildeSmall[] ={
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0010 (16) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000A, 0xA71F, 0xFFFF, 0xFFFC, 0xA2A0, 0x0000, 0x0418, 0xC400, // 0x0020 (32) pixels
0x553C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC400, 0x5538, 0xA2A0, 0x0000, 0x02B4, 0xE7FF, 0xFFFF, 0xFE30, 0x0000, // 0x0030 (48) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0040 (64) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};

View file

@ -904,39 +904,54 @@ void drawSMeter()
lastSMeterBarWidth = width; lastSMeterBarWidth = width;
} }
enum menuItems
{
oneMhzPlace = 0,
hundredKhzPlace = 1,
tenKhzPlace = 2,
oneKhzPlace = 3,
hundredHzPlace = 4,
tenHzPlace = 5,
oneHzPlace = 6,
filterLower = 7,
filterUpper = 8,
modeMenu = 9,
volumeMenu = 10,
};
void updateMenu() void updateMenu()
{ {
switch(menuPos) switch(menuPos)
{ {
case 0: //1,000,000 place case oneMhzPlace:
frequencyDialMultiplier = 1000000; frequencyDialMultiplier = 1000000;
updateVfo(); updateVfo();
break; break;
case 1: //100,000 place case hundredKhzPlace:
frequencyDialMultiplier = 100000; frequencyDialMultiplier = 100000;
updateVfo(); updateVfo();
break; break;
case 2: //10,000 place case tenKhzPlace:
frequencyDialMultiplier = 10000; frequencyDialMultiplier = 10000;
updateVfo(); updateVfo();
break; break;
case 3: //1,000 place case oneKhzPlace:
frequencyDialMultiplier = 1000; frequencyDialMultiplier = 1000;
updateVfo(); updateVfo();
break; break;
case 4: //100 place case hundredHzPlace:
frequencyDialMultiplier = 100; frequencyDialMultiplier = 100;
updateVfo(); updateVfo();
break; break;
case 5: //10 place case tenHzPlace:
frequencyDialMultiplier = 10; frequencyDialMultiplier = 10;
updateVfo(); updateVfo();
break; break;
case 6: //1 place case oneHzPlace:
frequencyDialMultiplier = 1; frequencyDialMultiplier = 1;
updateVfo(); updateVfo();
break; break;
case 7: //Filter Lower Limit case filterLower:
encoderPos = getPos(); encoderPos = getPos();
if(encoderPos != encoderLastPos) if(encoderPos != encoderLastPos)
{ {
@ -948,7 +963,7 @@ void updateMenu()
populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit); populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit);
} }
break; break;
case 8: //Filter Upper case filterUpper:
encoderPos = getPos(); encoderPos = getPos();
if(encoderPos != encoderLastPos) if(encoderPos != encoderLastPos)
{ {
@ -960,7 +975,7 @@ void updateMenu()
populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit); populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit);
} }
break; break;
case 9: //Mode case modeMenu:
encoderPos = getPos(); encoderPos = getPos();
if(encoderPos != encoderLastPos) if(encoderPos != encoderLastPos)
{ {
@ -972,7 +987,7 @@ void updateMenu()
//Right now all this does is turns the AM decoder on and off, I guess. //Right now all this does is turns the AM decoder on and off, I guess.
} }
break; break;
case 10: //Volume case volumeMenu:
encoderPos = getPos(); encoderPos = getPos();
if(encoderPos != encoderLastPos) if(encoderPos != encoderLastPos)
{ {
@ -1010,6 +1025,12 @@ float calculateRmsOfSample(float* samples, int length)
//TODO: Should I make a menuItem struct? Would that be helpful? The menus are a pain right now... //TODO: Should I make a menuItem struct? Would that be helpful? The menus are a pain right now...
uint8_t redItems[30]; uint8_t redItems[30];
enum modes
{
LSB = 0,
USB = 1,
AM = 2
};
void updateDisplay(uint8_t force) void updateDisplay(uint8_t force)
{ {
@ -1017,6 +1038,7 @@ void updateDisplay(uint8_t force)
static char freqChar[14]; static char freqChar[14];
static char lastFreqChar[] = {'$','$','$','$','$','$','$','$','$','$','$','$','$','$',}; static char lastFreqChar[] = {'$','$','$','$','$','$','$','$','$','$','$','$','$','$',};
//Draw elements that don't normally change. Static icons, etc.
if(force) if(force)
{ {
//Adafruit_GFX_drawColorBitmap(180, 2, psdrLogo, 86,20, MASKWHITE); //Adafruit_GFX_drawColorBitmap(180, 2, psdrLogo, 86,20, MASKWHITE);
@ -1026,7 +1048,7 @@ void updateDisplay(uint8_t force)
drawNumber('.', freqHOffset + 16*2, freqVOffset + 0, MASKWHITE); drawNumber('.', freqHOffset + 16*2, freqVOffset + 0, MASKWHITE);
drawNumber('.', freqHOffset + 16*6, freqVOffset + 0, MASKWHITE); drawNumber('.', freqHOffset + 16*6, freqVOffset + 0, MASKWHITE);
Adafruit_GFX_drawColorBitmap(142, 162, bitmapSMeter, 155, 10, MASKWHITE); Adafruit_GFX_drawColorBitmap(142, 162, bitmapSMeter, 155, 10, MASKWHITE);
Adafruit_GFX_drawColorBitmap(320 - 45 - 2, 240 - 46 - 2, bitmapHadLogo, 45, 46, MASKWHITE); //Adafruit_GFX_drawColorBitmap(320 - 45 - 2, 240 - 46 - 2, bitmapHadLogo, 45, 46, MASKWHITE);
} }
sprintf(&freqChar, "%8d", vfoAFrequency); sprintf(&freqChar, "%8d", vfoAFrequency);
@ -1068,55 +1090,93 @@ void updateDisplay(uint8_t force)
vfoALastFreq = vfoAFrequency; vfoALastFreq = vfoAFrequency;
strcpy(lastFreqChar, freqChar); strcpy(lastFreqChar, freqChar);
if(filterLowerLimit != filterLastLowerLimit || force || (menuPos != menuLastPos && (menuPos == 7 || menuLastPos == 7))) int redrawFilterBar = 0;
if(mode != modeLast || filterLowerLimit != filterLastLowerLimit || force || (menuPos != menuLastPos && (menuPos == 7 || menuLastPos == 7)))
{ {
sprintf(&freqChar, "%4d", filterLowerLimit * 40); sprintf(&freqChar, "%4d", filterLowerLimit * 40);
Adafruit_GFX_setTextSize(2); //Adafruit_GFX_setTextSize(2);
Adafruit_GFX_setTextColor(menuPos == 7 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); //Adafruit_GFX_setTextColor(menuPos == 7 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK);
Adafruit_GFX_setCursor(200, 135 ); //Adafruit_GFX_setCursor(200, 135 );
int i; int i;
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
Adafruit_GFX_write(freqChar[i]); //Adafruit_GFX_write(freqChar[i]);
drawNumberSmall(freqChar[i], 205 + (i * 9), 137, menuPos == 7 ? MASKRED : MASKWHITE);
} }
//Adafruit_GFX_setTextSize(3); //Adafruit_GFX_setTextSize(3);
Adafruit_GFX_fillRect(121, 120, 3, 100 , ILI9340_BLACK); redrawFilterBar = 1;
Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit - filterLowerLimit)/2, ILI9340_WHITE);
filterLastLowerLimit = filterLowerLimit; filterLastLowerLimit = filterLowerLimit;
} }
if(filterUpperLimit != filterLastUpperLimit || force || (menuPos != menuLastPos && (menuPos == 8 || menuLastPos == 8))) if(mode != modeLast || filterUpperLimit != filterLastUpperLimit || force || (menuPos != menuLastPos && (menuPos == 8 || menuLastPos == 8)))
{ {
sprintf(&freqChar, "%-4d", filterUpperLimit * 40); sprintf(&freqChar, "%-4d", filterUpperLimit * 40);
Adafruit_GFX_setTextSize(2); //Adafruit_GFX_setTextSize(2);
Adafruit_GFX_setTextColor(menuPos == 8 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); //Adafruit_GFX_setTextColor(menuPos == 8 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK);
Adafruit_GFX_setCursor(265, 135 ); //Adafruit_GFX_setCursor(265, 135 );
int i; int i;
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
Adafruit_GFX_write(freqChar[i]); //Adafruit_GFX_write(freqChar[i]);
drawNumberSmall(freqChar[i], 250 + (i * 9), 137, menuPos == 8 ? MASKRED : MASKWHITE);
} }
//Adafruit_GFX_setTextSize(3); //Adafruit_GFX_setTextSize(3);
Adafruit_GFX_fillRect(121, 120, 3, 100 , ILI9340_BLACK); redrawFilterBar = 1;
Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit - filterLowerLimit)/2, ILI9340_WHITE);
filterLastUpperLimit = filterUpperLimit; filterLastUpperLimit = filterUpperLimit;
} }
if(afGainLast != afGain || force || (menuPos != menuLastPos && (menuPos == volumeMenu || menuLastPos == volumeMenu)))
{
sprintf(&freqChar, "%-4f", afGain * 100);
int i;
for(i = 0; i < 4; i++)
{
//Adafruit_GFX_write(freqChar[i]);
drawNumberSmall(freqChar[i], 250 + (i * 9), 10, menuPos == volumeMenu ? MASKRED : MASKWHITE);
}
afGainLast = afGain;
}
//I think I want to make this more like the Draw S Meter, where it only draws the parts that have changed. Also, I think I want to do gray pixels when half
//way between values.
if(redrawFilterBar)
{
switch(mode)
{
case LSB:
Adafruit_GFX_fillRect(121, 0, 3, 240 , ILI9340_BLACK); //erase the old bar
Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit/2 - filterLowerLimit/2), ILI9340_WHITE); //draw the new one
break;
case USB:
Adafruit_GFX_fillRect(121, 0, 3, 240 , ILI9340_BLACK);
Adafruit_GFX_fillRect(121, 120 - (filterUpperLimit/2), 3, (filterUpperLimit/2 - filterLowerLimit/2), ILI9340_WHITE);
break;
case AM:
Adafruit_GFX_fillRect(121, 0, 3, 240 , ILI9340_BLACK);
Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit/2 - filterLowerLimit/2), ILI9340_WHITE);
Adafruit_GFX_fillRect(121, 120 - (filterUpperLimit/2), 3, (filterUpperLimit/2 - filterLowerLimit/2), ILI9340_WHITE);
break;
}
redrawFilterBar = 0;
}
if(mode != modeLast || force || (menuPos != menuLastPos && (menuPos == 9 || menuLastPos == 9))) if(mode != modeLast || force || (menuPos != menuLastPos && (menuPos == 9 || menuLastPos == 9)))
{ {
switch(mode) switch(mode)
{ {
case 0: //LSB case LSB:
Adafruit_GFX_drawColorBitmap(196, 91, bitmapLSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); Adafruit_GFX_drawColorBitmap(196, 91, bitmapLSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE);
break; break;
case 1: //USB case USB:
Adafruit_GFX_drawColorBitmap(196, 91, bitmapUSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); Adafruit_GFX_drawColorBitmap(196, 91, bitmapUSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE);
break; break;
case 2: //AM case AM:
Adafruit_GFX_drawColorBitmap(196, 91, bitmapAM, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); Adafruit_GFX_drawColorBitmap(196, 91, bitmapAM, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE);
break; break;
} }
@ -1412,6 +1472,51 @@ void drawNumber(char c, uint16_t x, uint16_t y, uint16_t tintMask)
} }
} }
void drawNumberSmall(char c, uint16_t x, uint16_t y, uint16_t tintMask)
{
switch(c)
{
case '1':
Adafruit_GFX_drawColorBitmap(x, y, oneSmall, 8, 9, tintMask);
break;
case '2':
Adafruit_GFX_drawColorBitmap(x, y, twoSmall, 8, 9, tintMask);
break;
case '3':
Adafruit_GFX_drawColorBitmap(x, y, threeSmall, 8, 9, tintMask);
break;
case '4':
Adafruit_GFX_drawColorBitmap(x, y, fourSmall, 8, 9, tintMask);
break;
case '5':
Adafruit_GFX_drawColorBitmap(x, y, fiveSmall, 8, 9, tintMask);
break;
case '6':
Adafruit_GFX_drawColorBitmap(x, y, sixSmall, 8, 9, tintMask);
break;
case '7':
Adafruit_GFX_drawColorBitmap(x, y, sevenSmall, 8, 9, tintMask);
break;
case '8':
Adafruit_GFX_drawColorBitmap(x, y, eightSmall, 8, 9, tintMask);
break;
case '9':
Adafruit_GFX_drawColorBitmap(x, y, nineSmall, 8, 9, tintMask);
break;
case '0':
Adafruit_GFX_drawColorBitmap(x, y, zeroSmall, 8, 9, tintMask);
break;
case '-':
Adafruit_GFX_drawColorBitmap(x, y, hyphenSmall, 8, 9, tintMask);
break;
case '~':
Adafruit_GFX_drawColorBitmap(x, y, tildeSmall, 8, 9, tintMask);
break;
default:
Adafruit_GFX_fillRect(x, y, 8, 9, ILI9340_BLACK);
}
}
//TIM_TimeBaseInitTypeDef timeBaseStructure; //TIM_TimeBaseInitTypeDef timeBaseStructure;
// //
//TIM_OC_InitTypeDef tsConfig; //TIM_OC_InitTypeDef tsConfig;