TinyCircuits Forum

TinyCircuits Products => User Projects / Code Examples => Topic started by: Manny on May 13, 2020, 03:56:52 PM

Title: TinyTV double digits channel numbers
Post by: Manny on May 13, 2020, 03:56:52 PM
How does a noob like me edit the code to make the TnyTV display double digit channel numbers?
What I mean is currently the TinyTV displays channels 0 to 9. I would like to change that to channel 0 to 20 or 1 to 20.
I Found one section in the Sketch for channel numbers that says something like 0 to 10 but when I change the 10 to something higher, only special characters are displayed beyond channel 9 on the TinyTV and are still in single digits.


Edited:
I did it. Heres the fix.

void showChannelNumber() {
  char channelString[] = "00";
  if(currentFileNum>9){
     channelString[0]+= currentFileNum/10;
  }
  channelString[1] += (currentFileNum % 10);
  int yOffset = 50;
  int xPosition = 80;
  int xWidth = display.getPrintWidth(channelString);


This fix was to use my previous changes and also uncomment the forward slashes /
Title: Re: TinyTV double digits channel numbers
Post by: Manny on May 13, 2020, 06:00:53 PM
ok so I changed this code in videoPlayerEffects.h

void showChannelNumber() {
  char channelString[] = "0";
  //if(currentFileNum>9){
  //   channelString[0]+= currentFileNum/10;
  //}
  channelString[0] += (currentFileNum % 10);
  int yOffset = 50;
  int xPosition = 80;
  int xWidth = display.getPrintWidth(channelString);



to this




void showChannelNumber() {
  char channelString[] = "00";
  //if(currentFileNum>9){
  //   channelString[0]+= currentFileNum/10;
  //}
  channelString[1] += (currentFileNum % 10);
  int yOffset = 50;
  int xPosition = 80;
  int xWidth = display.getPrintWidth(channelString);




Now I have double digits like 02, 03, 04, 05 etc. but I still cant get the channel numbers to go above 09


If I change this line
 channelString[1] += (currentFileNum % 10);

to this

 channelString[0] += (currentFileNum % 10);

The channels will go up by 10s like 20, 30, 40, 50  etc


Does anyone know what I cant try?
Title: Re: TinyTV double digits channel numbers
Post by: Manny on May 13, 2020, 07:52:47 PM
I got it working. Woohoo. I figured iit out myself.

Heres the code

void showChannelNumber() {
  char channelString[] = "00";
  if(currentFileNum>9){
     channelString[0]+= currentFileNum/10;
  }
  channelString[1] += (currentFileNum % 10);
  int yOffset = 50;
  int xPosition = 80;
  int xWidth = display.getPrintWidth(channelString);


This fix was to use my previous changes and also uncomment the forward slashes /
Title: Re: TinyTV double digits channel numbers
Post by: lennevia on May 14, 2020, 03:26:50 PM
Well done!

Thanks for updating with your findings!