Simple Wi-Fi signal strength



  • It's like an icon of LTE signal strength, but...
    Of course, I wanted to do it in a way that everyone knows, but...It's too complicated. Does anyone have a simple implementation experience?

    void showWifiSignal()
    {

    int nWifi = getWifidBm();
    M5.Lcd.setCursor(2, 30);
    M5.Lcd.setTextSize(1);
    M5.Lcd.print(String(nWifi)+"dBm");

    if(nWifi < -50 && nWifi == 0 )
    {
    M5.Lcd.drawRoundRect(30, 12, 5, 16, 1, LIGHTGREY);

    }
    else
    {
    M5.Lcd.fillRoundRect(30, 12, 5, 16, 1, BLACK);
    }

    if(nWifi < -70 && nWifi == 0)
    {
    M5.Lcd.drawRoundRect(22, 16, 5, 12, 1, LIGHTGREY);

    }
    else
    {
    M5.Lcd.fillRoundRect(22, 16, 5, 12, 1, BLACK);
    }

    if(nWifi < -80 && nWifi == 0)
    {
    M5.Lcd.drawRoundRect(14, 20, 5, 8, 1, LIGHTGREY);

    }
    else
    {
    M5.Lcd.fillRoundRect(14, 20, 5, 8, 1, BLACK);
    }

    if(nWifi < -90 && nWifi == 0)
    {
    M5.Lcd.drawRoundRect(6, 23, 5, 5, 1, LIGHTGREY);
    }
    else
    {
    M5.Lcd.fillRoundRect(6, 23, 5, 5, 1, BLACK);
    }
    }