Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 201_test-UI 200_yotsuba_21
Diff: ui.cpp
- Revision:
- 2:a5e8e6156172
- Parent:
- 1:ed6249618fd3
- Child:
- 3:1f322deb75d8
--- a/ui.cpp Wed Mar 03 11:49:25 2021 +0000
+++ b/ui.cpp Thu Mar 04 11:38:44 2021 +0000
@@ -19,32 +19,30 @@
void UI::updatebt()
{
- b0 = b0_ * 100;
+ b0 = b0_ * 10;
for(int i = 0; i < 4; i++){
- if((b0 > 10*(2*i + 3)) && (b0 < 10*(2*i + 5))) b[i] = 1;
+ if((b0 > (2*i + 3)) && (b0 < (2*i + 5))) b[i] = 1;
else b[i] = 0;
}
- if(b[0] && (!b_[0])){
- team = !team;
- buzz.beep(1760.0,0.2);
- }
- if(b[1] && (!b_[1])){
- ++algorithm %= 5;
- buzz.beep(1760.0,0.4);
+ if (mode == 0) {
+ if(b[0] && (!b_[0])){
+ team = !team;
+ }
+ if(b[1] && (!b_[1])){
+ ++algorithm %= 5;
+ }
}
if(b[2] && (!b_[2])){
- ++displayst %= 4;
- buzz.beep(1760.0,0.6);
+ ++displayst %= 6;
}
if(b[3] && (!b_[3])){
start = !start;
- buzz.beep(1760.0,0.6);
}
for(int i = 0; i < 4; i++) b_[i] = b[i];
mode = (4*!tgl1)+(2*!tgl2)+(!tgl3);
}
-void UI::change(char *valname1_, char *valname2_, double *dispvalue_)
+void UI::change(char *valname1_, char *valname2_, int *dispvalue_)
{
name1 = valname1_;
name2 = valname2_;
@@ -52,42 +50,26 @@
dispvalue[1] = dispvalue_[1];
}
-//void UI::display(char *valname1, char *valname2, double *dispvalue)
void UI::display()
{
while(1) {
updatebt();
- ThisThread::sleep_for(10ms);
lcd.clear();
lcd.setCursor(0,0);
- lcd.print(algorithm);//algo
+ lcd.print(algorithm);
lcd.setCursor(0,0);
- lcd.print(algorithm);//algo
- lcd.setCursor(1,0);
+ lcd.print(algorithm);
lcd.print(displayst);
- lcd.setCursor(2,0);
- lcd.print(name1);//
- lcd.setCursor(5,0);
+ lcd.print(name1);
lcd.print(dispvalue[0]);
- /*
- lcd.print(b[0]);
- lcd.setCursor(6,0);
- lcd.print(b[1]);
- lcd.setCursor(7,0);
- lcd.print(b[2]);
- */
lcd.setCursor(0,1);
- lcd.print(team);//team
- lcd.setCursor(1,1);
+ lcd.print(team);
lcd.print(mode);
- lcd.setCursor(2,1);
- lcd.print(name2);//
- lcd.setCursor(5,1);
+ lcd.print(name2);
lcd.print(dispvalue[1]);
-// lcd.print(b0);
- ThisThread::sleep_for(40);
+ ThisThread::sleep_for(10);
}
}
@@ -97,4 +79,11 @@
{
buf[i] = name1[i];
}
+}
+
+void UI::returnbt(uint8_t *mainbt)
+{
+ for(int i = 0; i < 4; i++){
+ mainbt[i] = b[i];
+ }
}
\ No newline at end of file