From cf51537b9d456d2a60dc02f0dc399ec1ca6e48a4 Mon Sep 17 00:00:00 2001 From: Wataru KUNINO Date: Sat, 15 Jun 2024 17:03:27 +0900 Subject: [PATCH] =?UTF-8?q?=EF=BC=93=EF=BC=93=E5=9B=9E=E8=BB=A2=EF=BC=94?= =?UTF-8?q?=EF=BC=95=E5=9B=9E=E8=BB=A2=E3=81=AE=E8=87=AA=E5=8B=95=E5=88=87?= =?UTF-8?q?=E6=8F=9B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stick_cplus/ex52_rpm/ex52_rpm.ino | 22 +++++++++++++--------- stick_cplus/ex52_rpm/get_html.ino | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/stick_cplus/ex52_rpm/ex52_rpm.ino b/stick_cplus/ex52_rpm/ex52_rpm.ino index 2e6c997..63383c2 100644 --- a/stick_cplus/ex52_rpm/ex52_rpm.ino +++ b/stick_cplus/ex52_rpm/ex52_rpm.ino @@ -36,7 +36,8 @@ This code was forked by Wataru KUNINO from the following authors: #define GRAV_MPS2 9.80665 // 重力加速度(m/s2) #define DEG_MAX 6.0 // 水平レベル測定用最大角度 #define ERR_MAX 20. // RPM測定用最大誤差(%) -#define RPM_TYP 33.333 // RPM測定用基準値(RPM) +#define RPM_TYP_33 33.333 // 33 1/3 回転RPM測定用基準値(RPM) +#define RPM_TYP_45 45.000 // 45 回転時 RPM測定用基準値(RPM) #define BUF_N 10 // 残像表示用バッファ数 RTC_DATA_ATTR float CAL_GyroX = 0.; // 角速度Xキャリブレーション値 @@ -64,6 +65,7 @@ uint16_t wow[212]; // WOW測定結果 100倍値 uint16_t level[212]; // 角度測定結果 1000倍値 uint16_t meas[212]; // 測定時刻 int line_x = 27; // 折れ線グラフのX座標 +float rpm_typ = RPM_TYP_33; // 33回転を設定 void buf_init(){ for(int i=0; i= 212) i = 0; - tx += String(meas[i] - ms)+", " + uint16_t ms_ui = meas[i] - ms; + tx += String((int)ms_ui)+", " + String((float)level[i]/1000.,3)+", " + String((float)rpm[i]/1000.,3)+", " + String((float)wow[i]/100.,2)+"\r\n"; @@ -274,8 +277,9 @@ void loop() { float deg = sqrt(pow(degx,2)+pow(degy,2)); rpm1 = fabs(gyroZ) / 6.; rpm2 = 60 * sqrt(fabs(accY) / 39.478 / RADIUS_CM * 100); - int rpm1_y = int(67.5 - 67. * (rpm1 - RPM_TYP) / RPM_TYP / ERR_MAX * 100); - int rpm2_y = int(67.5 - 67. * (rpm2 - RPM_TYP) / RPM_TYP / ERR_MAX * 100); + rpm_typ = rpm1 < 38.73 ? RPM_TYP_33 : RPM_TYP_45; + int rpm1_y = int(67.5 - 67. * (rpm1 - rpm_typ) / rpm_typ / ERR_MAX * 100); + int rpm2_y = int(67.5 - 67. * (rpm2 - rpm_typ) / rpm_typ / ERR_MAX * 100); int flag_dx = 0; // モードに応じた処理部(メインボタン押下で切り替え) diff --git a/stick_cplus/ex52_rpm/get_html.ino b/stick_cplus/ex52_rpm/get_html.ino index 3db3018..a56fde1 100644 --- a/stick_cplus/ex52_rpm/get_html.ino +++ b/stick_cplus/ex52_rpm/get_html.ino @@ -16,7 +16,7 @@ String getHtml(int target, float level, float rpm, float wow){ ip>>24 ); snprintf(html,_html_size,"\n\nWi-Fi 回転数RPM計\n\n\n\n\n

M5Stick STATUS

\n",s_ip); - if(wow>=1) sprintf(s,"---"); else sprintf(s,"%.2f",wow); + if(wow>=100) sprintf(s,"---"); else sprintf(s,"%.2f",wow); snprintf(html,_html_size,"%s\n

Level=%.3f °

RPM=%.3f rpm

WOW=%s %%

",html,level,rpm,s); if(target<0) sprintf(s,"

Pause

"); else sprintf(s,"

Mode=%d

",target); snprintf(html,_html_size,"%s\n%s\n
\n

LCD切替

\n

http://%s/?mode=n
\n

",html,s,s_ip);