I wanted to get my Photon based Alarm Clock project on here to get some feedback. I know there are some things I can do to improve the code. I know that when I uncomment my alarm tone code, it SOS’s due to memory. I think it has to do with using the linked lists. They are so easy and I usually get weird results when using just arrays. So any help there would be appreciated. Of course I intend to expand on the alarms themselves, this is just a POC implementation there.
Let me know what you guys think. Feedback welcome!
You’d need to give some more info about detail what exactly you ask there.
At the moment I can’t see what could pose a problem when turning a reading 0…-127 into any kind of visual output.
But what kind of screen are you thinking of?
Currently I’m using the SSD1351 1.5" OLED from Adafruit. I would like to show a standard meter like you’d see on a phone or whatever. I’m just not sure what’s the best way to display it. I tried Googling for some examples, but couldn’t get the wording such that it was specific enough.
If this way to display the signal is sufficient then a very basic approach would look like this
// signalStrength should be mapped into 0..+127
void drawIcon(int x, int y, int wh, int color, int signalStrength)
{
int dist = wh / 5; // distance between blocks
int sect = 127 / 5; //
drawRect(x, y, wh, wh, color); // square frame
x += dist/2; // set starting point for first line
y += wh - dist/2;
for (int i = 0; i < 5; i++)
{
if (signalStrength > i * sect) // draw bar if signal strength is above threshold
display.drawLine(x + i*dist, y, x + i*dist, y - (i+1)*dist, color);
else // otherwise don't draw and bail out
{
break;
// or carry on with
// display.drawLine(x + i*dist, y, x + i*dist, y - (i+1)*dist, dimColor);
}
}
}
Oh, right, yes! I’m sorry, I was thinking that the last statement was referring to the first.
In any case, I did a lot of Googling to try to find a font that I could drop in with WiFi signal strength icons but had no real luck. I don’t think it would be hard to do with The Dot Factory and some images, I think. With that I could get a bit fancier. What do you think?
EDIT:
I guess I should outline what I mean by “no real luck.” There are fonts out there like Font Awesome, which has a WiFi icon, but it’s stuck out in Unicode land which TDF doesn’t really let me get at easily. There are tons of SVG icons but TDF doesn’t convert SVG. So, I think I’d have to take a set of images and convert them in TDF to create a “font” that can be dropped into mfGFX. If/when I do, I will share it with the community.
If anyone knows of one I missed, please, let me know!