San Yune / Mbed 2 deprecated Chapter003_TRobot

Dependencies:   F746_GUI Array_Matrix TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG SDFileSystem_Warning_Fixed FrequencyResponseDrawer F746_SAI_IO

Revision:
2:2478e7a8e8d5
Parent:
0:04b43b777fae
Child:
3:cda40218256c
--- a/MyClasses_Functions/FrquencyResponseDrawer.cpp	Wed Apr 20 12:10:17 2016 +0000
+++ b/MyClasses_Functions/FrquencyResponseDrawer.cpp	Mon Apr 25 00:49:09 2016 +0000
@@ -2,7 +2,7 @@
 //  周波数が対数スケールの周波数特性を描画するクラス
 //  FrqRespDrawer class
 //
-//  2016/04/18, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/25, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "FrquencyResponseDrawer.hpp"
@@ -36,8 +36,9 @@
         lcd_->DrawVLine(X(MAX_), y0, height);   // 最大値に対応する線
         
         uint16_t width = X(MAX_) - X(MIN_);
-        for (int n=0; n<= (MAX_DB_ - MIN_DB_)/10; n++)
-            lcd_->DrawHLine(X(MIN_), ORGY_-DB10_*n, width);
+        int count =Round((MAX_DB_ - MIN_DB_)/(Y_SPACE_/DB1_));
+        for (int n=0; n<= count; n++)
+            lcd_->DrawHLine(X(MIN_), ORGY_-Y_SPACE_*n, width);
     }
 
     // 横軸の目盛値の表示
@@ -51,17 +52,19 @@
         Label l_frq(x0, ORGY_+20, str, Label::CENTER);
     }
 
-    // 縦軸の数値の表示
-    void FrqRespDrawer::DrawNumericY(int offsetX, int offsetY, int count,
-                                     uint16_t d_dB, const char fmt[], sFONT &fonts,
+    // 縦軸の目盛値の表示
+    void FrqRespDrawer::DrawNumericY(int offsetX, int offsetY, uint16_t d_dB,
+                                     const char fmt[], sFONT &fonts,
                                      uint32_t textColor, string str)
     {
         uint16_t x0 = ORGX_ + offsetX;
         uint16_t y0 = ORGY_ + offsetY;
-        for (int n=0; n<count; n++)
+        int count = Round((MAX_DB_ - MIN_DB_)/d_dB);
+
+        for (int n=0; n<=count; n++)
             NumericLabel<int> num(x0, y0-n*d_dB*DB1_,
                                   fmt, (int)(MIN_DB_+d_dB*n));
-        Label l_dB(x0, y0-(count-1)*d_dB*DB1_-12, str);
+        Label l_dB(x0, y0-count*d_dB*DB1_-12, str);
     }
 
     // 周波数特性のグラフの描画