LoginSignup
1
0

More than 3 years have passed since last update.

BetaFlight OSDもスロットルグラフ表示してみた

Last updated at Posted at 2017-10-18

BetaFlight OSD

  • MWOSDとは異なり、フライトコントローラーのCPUが直接描画を行うのでレスポンスに優れる。
  • MCMフォントフォーマットはMWOSDと共通だが、後半部分に起動ロゴビットマップを使用しているので、0xF0〜のコードを使用できない。コンパスを使用した矢印表示はあまり必要ないので、そのエリアをフォントマップに使用してみた。
  • BetaFlightのファームウェア本体を改造するため、ビルド後の改造ファームをフライトコントローラーに描き込む必要がある。
  • BetaFlightは3.2.0をosd表示のみ改造した。
  • フォントセットは、プリセットのすべてのフォントに対しグラフ表示部分0x60〜12文字分を書き換えているものを用意。

Macでビルド環境を構築する

  • 普通にDeveloper Toolsインストールする。最近はAppStoreよりXcodeをインストールするだけでOKみたい。
  • ARMのSDKをインストールする。BetaFlightのソースを解凍したディレクトリでコマンド一発で終了
$ cd betaflight-x.x.x
$ make arm_sdk_install
  • ターゲットを選択してビルドする。
$ make TARGET=hogehoge

コード

osd.c

    case OSD_THROTTLE_POS:
        buff[0] = SYM_THR;
        buff[1] = SYM_THR1;
        int throttle_per = (constrain(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX) - PWM_RANGE_MIN) * 100 / (PWM_RANGE_MAX - PWM_RANGE_MIN);
#ifdef THROTTLE_GRAPH
        throttle_per = throttle_per / 2; //0-50
        throttle_per = throttle_per>48 ? 48 : throttle_per; //0-48、まぁ95%以上なら100%扱いでいいだろう。
        int cur1 = throttle_per<12 ? throttle_per : 12; throttle_per = throttle_per<12 ? 0 : throttle_per-12;
        int cur2 = throttle_per<12 ? throttle_per : 12; throttle_per = throttle_per<12 ? 0 : throttle_per-12;
        int cur3 = throttle_per<12 ? throttle_per : 12; throttle_per = throttle_per<12 ? 0 : throttle_per-12;
        int cur4 = throttle_per<12 ? throttle_per : 12;
        buff[2] = 0x60 + cur1;
        buff[3] = 0x60 + cur2;
        buff[4] = 0x60 + cur3;
        buff[5] = 0x60 + cur4;
#else
        tfp_sprintf(buff + 2, "%d", throttle_per);
        //constrainで、lowとhigtの設定した値範囲の中の初手一を返す。
        //おそらく1070-1950くらいがデータとして返る。それをパーセンテージ表示に直してtfp_sprintfしている。
#endif
        break;

ダウンロード

222.png

BetaFlight(スロットル表示改)ファームウェアダウンロード

  • 3.2.0 -> 3.2.1 はバグフィックスのみとのこと。osd.cの改変はありませんでしたのでそのま移行。
  • 3.2.1 -> 3.2.2 OSD関係もいくつか修正があるみたいですね。FULL_CIRCLEって何だろう・・・
  • 3.2.2 -> 3.2.3
  • 3.2.3 -> 3.2.4
  • 3.2.4 -> 3.2.5 & 3.3.0 RC1
  • 3.3.0 RC1 -> 3.3.0 RC2 OSD関係は変更無し
  • 3.3.0 RC2 -> 3.3.0 RC3 OSD関係の修正あり
  • 3.3.0 RC3 -> 3.3.0 & ButterFlight 3.4.2 (clarity.mcmをフォントセットに追加)
  • 3.3.0 -> beta 3.3.1 & butter 3.5.0
  • 3.3.1 -> beta 3.3.2 & butter 3.5.1RC2
  • 3.3.2 -> 3.3.3 w/ RSSI Graph
  • 3.3.3 -> 3.4.0 RC1 -> 3.4.0 RC2
  • 3.4.0 RC2 -> 3.4.0 RC5 -> 3.4.0
  • 3.4.0 -> 3.4.1 & 3.5.0
  • 3.5.0 -> 3.5.1
  • 3.5.1 -> 3.5.2
  • 3.5.2 -> 3.5.3
  • 3.5.3 -> 3.5.4
  • 3.5.4 -> 3.5.5
  • 3.5.5 -> 3.5.6 & 4.0.0 RC1
  • 3.5.6 -> 3.5.7 & 4.0.0 RC2
  • 4.0.0 RC2 -> 4.0.0 RC4
  • 4.0.0 RC4 -> 4.0.0 RC6
  • RC6 -> 4.0.0
  • 4.0.0 -> 4.0.1
  • 4.0.1 -> 4.0.2
  • 4.0.2 -> 4.0.3
  • 4.0.3 -> 4.0.4
  • 4.0.4 -> 4.0.5
  • 4.0.5 -> 4.0.6

BF_date.png
ファームウェアとコンフィグレーターのリリース日付相関関係も纏めてみた。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0