From 3bdb147fdf5702ff1dc5fea281187ecab5d9665d Mon Sep 17 00:00:00 2001 From: Michael Colton Date: Wed, 30 Dec 2015 21:18:31 -0700 Subject: [PATCH] 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. --- Source/images/modes.png | Bin 875 -> 2264 bytes Source/include/images.h | 13 ++++ Source/src/images.c | 93 +++++++++++++++++++++- Source/src/main.c | 167 ++++++++++++++++++++++++++++++++-------- 4 files changed, 241 insertions(+), 32 deletions(-) diff --git a/Source/images/modes.png b/Source/images/modes.png index 0bafc903f0f12fed126518c6884621e15ab94efc..74ac319213f7ec5a07766e1e1581e4c6cdda0616 100644 GIT binary patch delta 2238 zcmV;v2toJj2G|iHiBL{Q4GJ0x0000DNk~Le0001(0000=2nGNE07o>P1(6{%e+X?! zL_t(|UhSPZcH&GBfQ$bu;9#ClfKPy(IC44}4skNsgp*BzLpz()krT`b%nAGm40qx0 zQma>0FA_)~sPDb9QL7g%MOF180fHTj=ex~LvYC%}MOsD1ySd7w*vxlhwco14CtN4X zxyygzPX=R{Z$4o*EH@Ry8GLT$e`0T(;p`vGQ<<2vBu~M{4{%p1*Ya@ygTVl9p0_e# zcn1%j@@$`P+&s)hli?z#yN`0e#&(Y=5f}L}weqoClw`WdSGXNK!m`{dK=-)Yfl#!h zi=4cCz_k3#To#!MhMmU5AUn`e;OCh&`cu!|&1f5FD{4G2#s zWK#y~D|q^;lqbUV75M#v3gbBl*ILvs+;f@egPjbSM~iJatvYUMKQK&dD+IIE$>~@5LsZ^QoQ0mDrkm=8(5f*sX$blrpH9`m8dSFqI@Hs#03i|jFd-Ywv!xCzxbY&iRrc}kPFd`!n` z6bI|UTE{=Udnhf@7#`HOM(kaS<2zV;Oi6ZZf)eOWX7#QtJbBUF>ixo0ai0vlrKwpTbNZK-4?yypZB!OlULbOGUx- z>VoZaxl+QNcO1@sd+VK6Pex|}KGpq42m%iHs`3g>#J z%3I>hi*Dihe@3QL$THqqHlOl1y2Ke6>y!9Y@;C#(?rIJSOpi^QA!&p23Js?0Ho&iL3}VR?BeoVBq`Yzj410_wWNzB@|)(< z7R=7OaV|yr{9~wc4TMbWh4^5aQn123Iq^tC1@mK?Y!^o;ds!BR0@EpXny+B4a#F+; zJO-9&e<);PFT|&kXI}+#?lxlTpzzC6)--m5Ddj@RS1`Lxlh-{DnO+xlEDeNA?1lJL z^6a5tRpn@C0a2Xe2;bm}K8Fy>M?tn-NVW4(7rNfGoMn)|FG9J@>;+Pc9o<55sr~c= z?_4R?^O37JC}-OQL%6ywKOP#p{fuWgyMolbe?Ev$B~Jqj7K@u~q40+m^g_%`3+A_> zB;Q2_+IM|#aUJSnA5Tpo6MG>(l{|G7%*h`nyk%f{A^J_Lb7rMIB3B zVHar;pNGxl_12r-G2m2_c|5Kqg6+#`rmi2U!$~RBw9dgV1-sB2#rwqQ)F z;9WgA3#Py{M5TwenfCGTO)f{ZVAOx+yuiD9a%O-n*XhyJ0PsjY(<&!v!4z!CP6xJN z0=x)Hs3*^okDUb`SM$MoC`|j*qhscgf3slwsyuZZwH|w;+D|{W*A{37PD&K1Z6CRx zdK$+NUCoeKiJ;hLHAQSS1Ey1}U=3zP2u0C;bVW#fHAal0?q)(J9#s^nZ6Dm{++Vep z%S{Zfhf?*sQs?Ua%ZsRUqVV(9Z9fLq(@@C7UWkutz09|j5(+Axe{*xJ z#fKEGf?4eoibLUi5$uJIx#ffBZ>NXL$I!=8Q_iaw={(oCfi<{4yC>XJO{VZ$FP#=K zOmZ=m^%@21Js!?Fv*mkw>2;LIbD946>!oMb`$H1Xb+!Sid3_L{oE52cR+LiiMhS)7 z7mERn+oN!g-&i0&E(^wh0T=7Lf9_EE7_y%Fa@ONu)gObvm$&5pD3^K5BlZ9nxvve< zFYlw6zXrynNRiDijw_WswsTD81>S_ zBG$0OL=|7+;@{mc%e@9cy4U>en>7wTfgMKZRbFm(rd zgO*VEF`ydra)(J`?Yr@tDo>pgg`by)DfSc}nH~$W%|)j$bypSA?2|%)>5ei`BoxFC z=v@+>1l*VC=qRPFOHp?-e<2flAwKp#>PBmeLX<^x`CxC%2!+}gQWCo-N}=|VvjO(F zSgJhvC3DZCE~f5!f|FACp_j<>X1W05!6x)R$XCHIbDEs>I2dz$daYn=xw>JW>&zC6 zX%$v5rd3$Mm{ws0V_Jn3jA<2CFs4;{J(ACyK5W65R$&EWS_I&K6cq-G$B>kh-~a#s M07*qoM6N<$g5tti_5c6? delta 838 zcmV-M1G)Uz5$gsaiBL{Q4GJ0x0000DNk~Le0001K0000U2nGNE057F5Ly;jge**wX zL_t(&L+zP6a;q>Dh7VZ_cH!{~i0Aztd9pAf7B1zforp7>|0=27HswzJ7K%9LzQH*{iZsm2F^RF z$*B5&({wRlC3*Rg_m{}7j#|e`I(pJLw5hq5x!bIdVJis^@M!rE^P>VgfD`?B&&6cMLc(!rfV$J+NU8ywt`RhBHVce-ftL$ELuZ z^%sAVagf0U4ehyz_Ww z7|U>xG#0chL!8e3I>SXee6075rg#v|xMT+>Hij>~*k@ztxvA}5P<=OQ zeT;B-rl6gR5h77cK|2QzvKzDA9bXXyb|L^_Z-Q>h6twdqrQ1zzsk5Gfb`IG0AC~Uw zM#tQEExUnAsK$=CQiNlUv8JP+A?`H?@^6?L9dqNgx0_T=E?jFbf9+~wlv_TYyw=n& z`sQHH`E|_Qo;XN#5k@O;>xGcSV#OobYEgU|^wKJl_Zn0J{w=9!BKp=#lOp^EEh2fa zbyzF*d2OWFRlr0WGMe7mOIV9*@I-IMXBdTAByWpV4JC%p!v(IzQ&+jX6rzZBI!E0@! z^bFkNQD28g2HjY+SmNz}7Wtjh)IV3p-0JMka98{nD@jKF9A{6>_Z~IC7Y;dcJ=YTr QWB>pF07*qoM6N<$f+pvIwg3PC diff --git a/Source/include/images.h b/Source/include/images.h index e4ffaf0..ed0ce0b 100644 --- a/Source/include/images.h +++ b/Source/include/images.h @@ -31,3 +31,16 @@ extern const unsigned short bitmapWebSdrGradient[]; extern const unsigned short bitmapFilter[]; extern const unsigned short bitmapHadLogo[]; 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[]; diff --git a/Source/src/images.c b/Source/src/images.c index 4438905..dff347b 100644 --- a/Source/src/images.c +++ b/Source/src/images.c @@ -1,9 +1,15 @@ #include "images.h" //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!! +//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 const const unsigned short psdrLogo[]={ 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 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}; + +//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}; diff --git a/Source/src/main.c b/Source/src/main.c index 02e0140..5886615 100644 --- a/Source/src/main.c +++ b/Source/src/main.c @@ -904,39 +904,54 @@ void drawSMeter() 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() { switch(menuPos) { - case 0: //1,000,000 place + case oneMhzPlace: frequencyDialMultiplier = 1000000; updateVfo(); break; - case 1: //100,000 place + case hundredKhzPlace: frequencyDialMultiplier = 100000; updateVfo(); break; - case 2: //10,000 place + case tenKhzPlace: frequencyDialMultiplier = 10000; updateVfo(); break; - case 3: //1,000 place + case oneKhzPlace: frequencyDialMultiplier = 1000; updateVfo(); break; - case 4: //100 place + case hundredHzPlace: frequencyDialMultiplier = 100; updateVfo(); break; - case 5: //10 place + case tenHzPlace: frequencyDialMultiplier = 10; updateVfo(); break; - case 6: //1 place + case oneHzPlace: frequencyDialMultiplier = 1; updateVfo(); break; - case 7: //Filter Lower Limit + case filterLower: encoderPos = getPos(); if(encoderPos != encoderLastPos) { @@ -948,7 +963,7 @@ void updateMenu() populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit); } break; - case 8: //Filter Upper + case filterUpper: encoderPos = getPos(); if(encoderPos != encoderLastPos) { @@ -960,7 +975,7 @@ void updateMenu() populateCoeficients(filterUpperLimit - filterLowerLimit, mode, filterLowerLimit); } break; - case 9: //Mode + case modeMenu: encoderPos = getPos(); if(encoderPos != encoderLastPos) { @@ -972,7 +987,7 @@ void updateMenu() //Right now all this does is turns the AM decoder on and off, I guess. } break; - case 10: //Volume + case volumeMenu: encoderPos = getPos(); 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... uint8_t redItems[30]; +enum modes +{ + LSB = 0, + USB = 1, + AM = 2 +}; void updateDisplay(uint8_t force) { @@ -1017,6 +1038,7 @@ void updateDisplay(uint8_t force) static char freqChar[14]; static char lastFreqChar[] = {'$','$','$','$','$','$','$','$','$','$','$','$','$','$',}; + //Draw elements that don't normally change. Static icons, etc. if(force) { //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*6, freqVOffset + 0, 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); @@ -1068,55 +1090,93 @@ void updateDisplay(uint8_t force) vfoALastFreq = vfoAFrequency; 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); - Adafruit_GFX_setTextSize(2); - Adafruit_GFX_setTextColor(menuPos == 7 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); - Adafruit_GFX_setCursor(200, 135 ); + //Adafruit_GFX_setTextSize(2); + //Adafruit_GFX_setTextColor(menuPos == 7 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); + //Adafruit_GFX_setCursor(200, 135 ); int 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_fillRect(121, 120, 3, 100 , ILI9340_BLACK); - Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit - filterLowerLimit)/2, ILI9340_WHITE); - + redrawFilterBar = 1; 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); - Adafruit_GFX_setTextSize(2); - Adafruit_GFX_setTextColor(menuPos == 8 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); - Adafruit_GFX_setCursor(265, 135 ); + //Adafruit_GFX_setTextSize(2); + //Adafruit_GFX_setTextColor(menuPos == 8 ? ILI9340_RED : ILI9340_WHITE, ILI9340_BLACK); + //Adafruit_GFX_setCursor(265, 135 ); int 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_fillRect(121, 120, 3, 100 , ILI9340_BLACK); - Adafruit_GFX_fillRect(121, filterLowerLimit/2 + 120, 3, (filterUpperLimit - filterLowerLimit)/2, ILI9340_WHITE); - + redrawFilterBar = 1; 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))) { switch(mode) { - case 0: //LSB + case LSB: Adafruit_GFX_drawColorBitmap(196, 91, bitmapLSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); break; - case 1: //USB + case USB: Adafruit_GFX_drawColorBitmap(196, 91, bitmapUSB, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); break; - case 2: //AM + case AM: Adafruit_GFX_drawColorBitmap(196, 91, bitmapAM, 28, 9, menuPos == 9 ? MASKRED : MASKWHITE); 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_OC_InitTypeDef tsConfig;