2
Dependencies: RemoteIR TextLCD
Diff: main.cpp
- Revision:
- 64:c74082c792ed
- Parent:
- 63:bddf342bce22
- Child:
- 65:7657ef347d6d
--- a/main.cpp Tue Sep 08 00:26:36 2020 +0000 +++ b/main.cpp Tue Sep 08 03:26:32 2020 +0000 @@ -4,9 +4,9 @@ */ /* - Version 0.06 + Version 0.07 Date 2020/09/08 - Uploader Tomotsugu Ogawa + Uploader Taku Nishimura 更新するときにここも変える! @@ -28,7 +28,7 @@ /* マクロ定義、列挙型定義 */ #define MIN_V 2.0 // 電圧の最小値 -#define MAX_V 2.67 // 電圧の最大値 +#define MAX_V 2.7 // 電圧の最大値 #define LOW 0 // モーターOFF #define HIGH 1 // モーターON #define NORMAL 0 // 普通 @@ -156,7 +156,9 @@ /* bChange, lcdbacklight用変数 */ TextLCD_I2C lcd(&i2c_lcd, (0x27 << 1), TextLCD::LCD16x2, TextLCD::HD44780); -int b = 0; // バッテリー残量 +int b10[10]; // バッテリー残量 +int b; +int aaaaa = 0; int flag_b = 0; // バックライト点滅フラグ int flag_t = 0; // バックライトタイマーフラグ @@ -856,14 +858,22 @@ /* バッテリー残量更新関数 */ void bChange(){ //pc.printf(" bChange1\r\n"); - if(run == STOP){ - b = (int)(((battery.read() * 3.3 - MIN_V)/0.67)*10+0.5)*10; + b10[aaaaa++] = (int)(((battery.read() * 3.3 - MIN_V)/0.7)*10+0.5)*10; + if(aaaaa == 10){ + aaaaa = 0; } + b = 0; + for(int i=0;i<10;i++){ + if(b<b10[i] && b10[i]<=100){ + b = b10[i]; + } + } + if(b <= 0){ // バッテリー残量0%なら全ての機能停止 - b = 0; - //lcd.setBacklight(TextLCD::LightOff); - //run = STOP; - //exit(1); // 電池残量が5%未満の時、LCDを消灯し、モーターを停止し、プログラムを終了する。 + //b = 0; + lcd.setBacklight(TextLCD::LightOff); + run = STOP; + exit(1); // 電池残量が5%未満の時、LCDを消灯し、モーターを停止し、プログラムを終了する。 } mutex.lock(); // ミューテックスロック lcd.setAddress(0,0); @@ -959,139 +969,139 @@ sprintf(webbuff, "%s%3d", webbuff, b); } strcat(webbuff, "%</strong>"); - strcat(webbuff, "<button id=\"reloadbtn\" type=\"button\" class=\"load\" onclick=\"location.reload()\">RELOAD</button>"); + strcat(webbuff, "<button id=\"reloadbtn\" type=\"button\" class=\"load\" onmousedown=\"location.reload()\">RELOAD</button>"); strcat(webbuff, "</td></p>"); strcat(webbuff, "<br>"); strcat(webbuff, "<table><tr><td></td><td>"); switch(mode) { //ブラウザ更新時の現在の車の状態からボタンの点灯判定 case ADVANCE: //前進 - strcat(webbuff, "<button id='gobtn' type='button' class=\"light\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"light\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case LEFT: //左折 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"light\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"light\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case STOP: //停止 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"light\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"light\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case RIGHT: //右折 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"light\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"light\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case BACK: //後進 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"light\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"light\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr><td>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case AVOIDANCE: //障害物回避 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"light\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"light\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; case LINE_TRACE: //ライントレース - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"light\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"light\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; default: //その他 - strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onClick='send_mes(this.value)'>GO"); + strcat(webbuff, "<button id='gobtn' type='button' class=\"noselect\" value=\"GO\" onmousedown='send_mes(this.value)'>GO"); strcat(webbuff, "</button></td><td></td></tr><tr><td>"); - strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onClick='send_mes(this.value)' >LEFT"); + strcat(webbuff, "<button id='leftbtn' type='button' class=\"noselect\" value=\"LEFT\" onmousedown='send_mes(this.value)' >LEFT"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onClick='send_mes(this.value)' >STOP"); + strcat(webbuff, "<button id='stopbtn' type='button' class=\"noselect\" value=\"STOP\" onmousedown='send_mes(this.value)' >STOP"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onClick='send_mes(this.value)' >RIGHT"); + strcat(webbuff, "<button id='rightbtn' type='button' class=\"noselect\" value=\"RIGHT\" onmousedown='send_mes(this.value)' >RIGHT"); strcat(webbuff, "</button></td></tr><td></td><td>"); - strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onClick='send_mes(this.value)' >BACK"); + strcat(webbuff, "<button id='backbtn' type='button' class=\"noselect\" value=\"BACK\" onmousedown='send_mes(this.value)' >BACK"); strcat(webbuff, "</button></td><td style='vertical-align:top; text-align:right;'></td></tr></table>"); strcat(webbuff, "<strong>Mode</strong>"); - strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onClick='send_mes(this.value)' >"); + strcat(webbuff, "<table><tr><td><button id='avoidbtn' type='button' class=\"noselect\" value=\"AVOIDANCE\" onmousedown='send_mes(this.value)' >"); strcat(webbuff, "AVOIDANCE</button></td><td>"); - strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onClick='send_mes(this.value)' >LINE_TRACE"); + strcat(webbuff, "<button id='tracebtn' type='button' class=\"noselect\" value=\"LINE_TRACE\" onmousedown='send_mes(this.value)' >LINE_TRACE"); break; } strcat(webbuff, "</button></td></tr></table>"); @@ -1100,32 +1110,32 @@ //ready示速度だけ点灯 switch (flag_sp) { //現在の速度のボタン表示 case 0: //ノーマル - strcat(webbuff, "<button id='sp1btn' type='button' class=\"light\" value=\"Normal\" onClick='send_mes_spe(this.value)' >Normal"); + strcat(webbuff, "<button id='sp1btn' type='button' class=\"light\" value=\"Normal\" onmousedown='send_mes_spe(this.value)' >Normal"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onClick='send_mes_spe(this.value)' >Fast"); + strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onmousedown='send_mes_spe(this.value)' >Fast"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onClick='send_mes_spe(this.value)' >VeryFast"); + strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onmousedown='send_mes_spe(this.value)' >VeryFast"); break; case 1: //ファスト - strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onClick='send_mes_spe(this.value)' >Normal"); + strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onmousedown='send_mes_spe(this.value)' >Normal"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp2btn' type='button' class=\"light\" value=\"Fast\" onClick='send_mes_spe(this.value)' >Fast"); + strcat(webbuff, "<button id='sp2btn' type='button' class=\"light\" value=\"Fast\" onmousedown='send_mes_spe(this.value)' >Fast"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onClick='send_mes_spe(this.value)' >VeryFast"); + strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onmousedown='send_mes_spe(this.value)' >VeryFast"); break; case 2: //ベリーファスト - strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onClick='send_mes_spe(this.value)' >Normal"); + strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onmousedown='send_mes_spe(this.value)' >Normal"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onClick='send_mes_spe(this.value)' >Fast"); + strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onmousedown='send_mes_spe(this.value)' >Fast"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp3btn' type='button' class=\"light\" value=\"VeryFast\" onClick='send_mes_spe(this.value)' >VeryFast"); + strcat(webbuff, "<button id='sp3btn' type='button' class=\"light\" value=\"VeryFast\" onmousedown='send_mes_spe(this.value)' >VeryFast"); break; default: //その他 - strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onClick='send_mes_spe(this.value)' >Normal"); + strcat(webbuff, "<button id='sp1btn' type='button' class=\"noselect\" value=\"Normal\" onmousedown='send_mes_spe(this.value)' >Normal"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onClick='send_mes_spe(this.value)' >Fast"); + strcat(webbuff, "<button id='sp2btn' type='button' class=\"noselect\" value=\"Fast\" onmousedown='send_mes_spe(this.value)' >Fast"); strcat(webbuff, "</button></td><td>"); - strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onClick='send_mes_spe(this.value)' >VeryFast"); + strcat(webbuff, "<button id='sp3btn' type='button' class=\"noselect\" value=\"VeryFast\" onmousedown='send_mes_spe(this.value)' >VeryFast"); break; } strcat(webbuff, "</button></td></tr></table>"); @@ -1505,6 +1515,9 @@ /* mainスレッド */ int main() { /* 初期設定 */ + for(int i=0;i<10;i++){ + b10[i] = (int)(((battery.read() * 3.3 - MIN_V)/0.7)*10+0.5)*10; + }; wifi_thread = new Thread(wifi); wifi_thread -> set_priority(osPriorityHigh); // setup();