Closed geeksville closed 4 years ago
Apparently that screen is 64x32 pixels? When it boots do you see 1/4th of the meshtastic logo? If so I would recommend the following next steps:
old code:
void drawFrameBluetooth(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
// Demonstrates the 3 included default sizes. The fonts come from SSD1306Fonts.h file
// Besides the default fonts there will be a program to convert TrueType fonts into this format
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(ArialMT_Plain_16);
display->drawString(64 + x, 2 + y, "Bluetooth");
display->setFont(ArialMT_Plain_10);
display->drawString(64 + x, SCREEN_HEIGHT - FONT_HEIGHT + y, "Enter this code");
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(ArialMT_Plain_24);
display->drawString(64 + x, 22 + y, btPIN);
ui.disableIndicator();
}
new code:
#ifdef BOARD_MAKERHAWK
// devices with tiny screens need to use tiny fonts
#define FONT_LARGEST ArialMT_Plain_10
#else
#define FONT_LARGEST ArialMT_Plain_24
#endif
void drawFrameBluetooth(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
DEBUG_MSG("Trying to pair bluetooth PIN %s\n", btPIN);
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(ArialMT_Plain_16);
display->drawString(SCREEN_WIDTH/2 + x, 2 + y, "Bluetooth");
display->setFont(ArialMT_Plain_10);
display->drawString(SCREEN_WIDTH/2 + x, SCREEN_HEIGHT - FONT_HEIGHT + y, "Enter this code");
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(FONT_LARGEST);
display->drawString(SCREEN_WIDTH / 2 + x, 22 + y, btPIN);
ui.disableIndicator();
}
^ this quick hacked up code is probably not exactly correct - but you can see changed my yucky absolute screen positions to be more relative to SCREEN_WIDTH. I also generalized the font selection so a tiny font is used on your device. Other functions in screen.cpp will probably also need to be tweaked to nicely look good on your device and the otehr devices. I also added a DEBUG_STR to print the pairing code to hte serial port so you can get past this point without the screen fully working.
I'm happy to help if you have more problems and I'd love a pull request once you have a nice clean set of changes needed to support your board.
@peoplesdriver - just checking in, did you ever do anything with this?
Ok - no word from @peoplesdriver - closing for now
From @peoplesdriver. I'll reply to this bug with some comments.
This board: https://www.amazon.co.uk/MakerHawk-Development-0-49inch-Bluetooth-Intelligent/dp/B07ML6528K/ref=redir_mobile_desktop?ie=UTF8&psc=1&ref=ppx_pop_mob_b_asin_image
I'm trying to use this board, but I can't see the pairing code on the screen as is a lot smaller