Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the MakerHawk OLED LORA board #9

Closed
geeksville opened this issue Feb 29, 2020 · 3 comments
Closed

Add support for the MakerHawk OLED LORA board #9

geeksville opened this issue Feb 29, 2020 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@geeksville
Copy link
Member

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

@geeksville geeksville added the enhancement New feature or request label Feb 29, 2020
@geeksville
Copy link
Member Author

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:

  • In screen.cpp, wrap SCREEN_WIDTH and SCREEN_HEIGHT definitions with an #ifdef BOARD_MAKERHAWK (which you will also define in configuration.h, so we can eventually make this a standard supported board)
  • For MAKERHAWK use 64x32 ;-)
  • Change the following code in screen.cpp:

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.

@geeksville geeksville added this to the After1.0 milestone Mar 4, 2020
@geeksville
Copy link
Member Author

@peoplesdriver - just checking in, did you ever do anything with this?

@geeksville
Copy link
Member Author

Ok - no word from @peoplesdriver - closing for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant