Skip to content

Commit 21711ba

Browse files
authored
Merge pull request #18 from ymw0407/NoticeAlert
Update : control UI ์ˆ˜์ •
2 parents 33fb5a1 + 600d883 commit 21711ba

File tree

16 files changed

+382
-191
lines changed

16 files changed

+382
-191
lines changed

โ€Žmain-NoticeAlert/home/arduino/windowBlind/windowBlind.inoโ€Ž

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
#define IN6 22
1212
#define IN7 14
1313
#define IN8 12
14-
#define W_STEP 685
14+
#define W_STEP 510
1515
#define B_STEP 3125
1616

1717
const int stepsPerRevolution = 64; // change this to fit the number of steps per revolution
1818

1919
// initialize the stepper library
2020
Stepper window(stepsPerRevolution, IN1, IN3, IN2, IN4);
21-
Stepper blind(stepsPerRevolution, IN5, IN7, IN6, IN8);
21+
//Stepper blind(stepsPerRevolution, IN5, IN7, IN6, IN8);
2222

2323
const char* ssid = "koss"; //์‚ฌ์šฉํ•˜๋Š” Wifi ์ด๋ฆ„
2424
const char* password = "a123456789!"; // ๋น„๋ฐ€๋ฒˆํ˜ธ
25-
const char* mqtt_server = "3.34.50.139"; // MQTT broker ip
25+
const char* mqtt_server = "3.34.1.95"; // MQTT broker ip
2626
const char* clientName = "wbController"; // client ์ด๋ฆ„
2727

2828
WiFiClient espClient; // ์ธํ„ฐ๋„ท๊ณผ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” client ์ƒ์„ฑ
@@ -83,17 +83,17 @@ void callback(char* topic, byte* payload, unsigned int uLen) {
8383
Serial.println(message[0]); // 1 or 0
8484

8585
if((String)topic == "control/window"){
86-
int move_step = (-W_STEP * (String(message[0]).toInt()-1)) - step1;
86+
int move_step = (W_STEP * (String(message[0]).toInt()-1)) - step1;
8787
Serial.print("move_step: "); Serial.println(move_step);
8888
window.step(move_step);
8989
step1 += move_step;
9090
}
91-
else if((String)topic == "control/blind"){
92-
int move_step = ((B_STEP-1) * (String(message[0]).toInt()-1)) - step2;
93-
Serial.print("move_step: "); Serial.println(move_step);
94-
blind.step(move_step);
95-
step2 += move_step;
96-
}
91+
// else if((String)topic == "control/blind"){
92+
// int move_step = (B_STEP * (String(message[0]).toInt()-1)) - step2;
93+
// Serial.print("move_step: "); Serial.println(move_step);
94+
// blind.step(move_step);
95+
// step2 += move_step;
96+
// }
9797
}
9898

9999
void setup() {
@@ -102,7 +102,7 @@ void setup() {
102102
setup_wifi();
103103

104104
window.setSpeed(300);
105-
blind.setSpeed(300);
105+
//blind.setSpeed(300);
106106

107107
client.setServer(mqtt_server, 1883); //mqtt ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ(ip, 1883)
108108
client.setCallback(callback); //callback ํ•จ์ˆ˜ ์„ธํŒ…
@@ -113,37 +113,28 @@ void loop() {
113113
client.loop(); //์—ฐ๊ฒฐ์„ ๊ณ„์†ํ•ด์„œ ์œ ์ง€ํ•˜๊ณ  ๋“ค์–ด์˜ค๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•จ
114114
int x = analogRead(36);
115115
int y = analogRead(39);
116-
if(x > 3000 && step1 >= -W_STEP * 4){
116+
117+
if(x > 3000 && step1 >= 0){
117118
window.step(-1);
118119
step1--;
119120
Serial.println("X-- ");
120121
}
121-
else if(x < 1000 && step1 <= 0){
122+
else if(x < 1000 && step1 <= W_STEP * 4){
122123
window.step(1);
123124
step1++;
124125
Serial.println("X++ ");
125126
}
126-
else if(y > 3000 && step2 >= 0){
127-
blind.step(-1);
128-
step2--;
129-
Serial.println("y-- ");
130-
}
131-
else if(y < 1000 && step2 <= B_STEP * 4){
132-
blind.step(1);
133-
step2++;
134-
Serial.println("y++ ");
135-
}
136-
// else if (prev1 != step1 || prev2 != step2){
137-
// char wbMessage[100] = "";
138-
// sprintf(wbMessage, "{'control': 'wb', 'wb': {'window1':%d, 'blind1':%d}}", step1, step2);
139-
// Serial.print("Publish message: ");
140-
// Serial.println(wbMessage);
141-
// client.publish("status/wb", wbMessage);
142-
// prev1 = step1;
143-
// prev2 = step2;
127+
// else if(y > 3000 && step2 >= 0){
128+
// blind.step(-1);
129+
// step2--;
130+
// Serial.println("y-- ");
144131
// }
132+
// else if(y < 1000 && step2 <= B_STEP * 4){
133+
// blind.step(1);
134+
// step2++;
135+
// Serial.println("y++ ");
145136
// Serial.print("X: ");
146137
// Serial.print(x);
147138
// Serial.print(" Y: ");
148139
// Serial.println(y);
149-
}
140+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.eslintcache

โ€Žmain-NoticeAlert/wallpad/control/control_app/.eslintcacheโ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
1+
12
tbody {
2-
border : 15px solid white;
3+
display: flex;
4+
text-align: center;
5+
align-items: center;
6+
justify-content: center;
37
}
48

59
input[type="checkbox"] {
6-
margin-left: 70px;
7-
width: 1.8rem;
8-
height: 1.8rem;
9-
border-radius: 50%;
10-
border: 10px solid white;
11-
appearance: none;
12-
cursor: pointer;
13-
transition: background 0.2s;
10+
position: absolute;
11+
padding: 0;
12+
overflow: hidden;
13+
clip:rect(0,0,0,0);
14+
border: 0;
15+
padding-right: 10px;
16+
}
17+
18+
.button {
19+
display: block;
20+
position: relative;
21+
float: left;
22+
width: 230px;
23+
height: 140px;
24+
padding: 0;
25+
margin: 10px 10px 0px 0;
26+
font-size: 1.3rem;
27+
font-weight: 600;
28+
text-align: center;
29+
line-height: 50px;
30+
color: rgb(39, 28, 28);
31+
border-radius: 30px;
32+
transition: all 0.2s ;
1433
}
1534

16-
input[type="checkbox"]:checked {
17-
margin-left: 70px;
18-
background: rgb(226, 93, 69);
19-
border: none;
35+
.btnLightBlue {
36+
background: rgb(226, 207, 62);
37+
border: #c16a2c;
38+
}
39+
.btnLightBlue.btnPush {
40+
box-shadow: 0px 30px 0px 0px rgb(181, 110, 67);
41+
}
42+
.btnLightBlue.btnPush:active {
43+
padding-top: 14px;
44+
padding-bottom: 5px;
45+
box-shadow: 0px 0px 0px 0px #c16a2c;
2046
}

โ€Žmain-NoticeAlert/wallpad/control/control_app/src/views/CheckBox.jsโ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const bridge = new LS2Request();
88
const StyledTable = styled.table`
99
text-align: center;
1010
border-collapse: collapse;
11+
background-color: rgb(37, 100, 101);
1112
tbody{
1213
tr{
1314
td{
1415
padding: 10px 10px;
15-
border-bottom: 5px solid #eee;
16+
padding-right: 10px;
1617
color: white;
1718
font-size: 25px;
1819
font-weight: 700;
20+
background-color: rgb(37, 100, 101);
1921
}
2022
}
2123
}
@@ -84,8 +86,8 @@ export default function CheckBox() {
8486
onChange={(e) => handleSingleCheck(e.target.checked3, data.id)}
8587
// ์ฒดํฌ๋œ ์•„์ดํ…œ ๋ฐฐ์—ด์— ํ•ด๋‹น ์•„์ดํ…œ์ด ์žˆ์„ ๊ฒฝ์šฐ ์„ ํƒ ํ™œ์„ฑํ™”, ์•„๋‹ ์‹œ ํ•ด์ œ
8688
checked3={checkItems3.includes(data.id) ? true : false} />
89+
<button className='button btnPush btnLightBlue'>{data.title}</button>
8790
</td>
88-
<td className='second-row'>{data.title}</td>
8991
</tr>
9092
))}
9193
</tbody>

โ€Žmain-NoticeAlert/wallpad/control/control_app/src/views/CheckBox2.jsโ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ const bridge = new LS2Request();
88
const StyledTable = styled.table`
99
text-align: center;
1010
border-collapse: collapse;
11+
background-color: rgb(37, 100, 101);
1112
tbody{
1213
tr{
1314
td{
1415
padding: 10px 10px;
15-
border-bottom: 5px solid #eee;
1616
color: white;
1717
font-size: 25px;
1818
font-weight: 700;
19+
background-color: rgb(37, 100, 101);
1920
}
21+
2022
}
2123
}
2224
.second-row{
@@ -84,8 +86,8 @@ export default function CheckBox2() {
8486
onChange={(e) => handleSingleCheck(e.target.checked2, data.id)}
8587
// ์ฒดํฌ๋œ ์•„์ดํ…œ ๋ฐฐ์—ด์— ํ•ด๋‹น ์•„์ดํ…œ์ด ์žˆ์„ ๊ฒฝ์šฐ ์„ ํƒ ํ™œ์„ฑํ™”, ์•„๋‹ ์‹œ ํ•ด์ œ
8688
checked2={checkItems2.includes(data.id) ? true : false} />
89+
<button className='button btnPush btnLightBlue'>{data.title}</button>
8790
</td>
88-
<td className='second-row'>{data.title}</td>
8991
</tr>
9092
))}
9193
</tbody>
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
.list {
2-
padding-left: -100px;
32
display: flex;
43
float: left;
54
text-align: center;
65
margin-top: 5px;
7-
margin-left: -100px;
6+
background-color: rgb(37, 100, 101);
87
}
98
.tem1 {
10-
padding-right: 250px;
9+
padding-right: 120px;
10+
background-color: rgb(37, 100, 101);
1111
}
1212
.tem1 p {
13-
font-size: 130px;
13+
font-size: 90px;
1414
font-weight: 600;
1515
padding-top: 50px;
16-
padding-bottom: 250px;
16+
padding-bottom: 150px;
1717
margin-left: 30px;
1818
color: white;
19+
background-color: rgb(37, 100, 101);
1920
}
2021
.tem2 {
21-
padding-right: 250px;
22+
padding-right: 120px;
23+
background-color: rgb(37, 100, 101);
2224
}
2325
.tem2 p {
24-
font-size: 130px;
26+
font-size: 90px;
2527
font-weight: 600;
2628
padding-top: 50px;
27-
padding-bottom: 250px;
29+
padding-bottom: 150px;
2830
margin-left: 30px;
2931
color: white;
32+
background-color: rgb(37, 100, 101);
3033
}
3134
.tem3 {
32-
padding-right: 150px;
35+
background-color: rgb(37, 100, 101);
3336
}
3437
.tem3 p {
35-
font-size: 130px;
38+
font-size: 90px;
3639
font-weight: 600;
3740
padding-top: 50px;
38-
padding-bottom: 250px;
41+
padding-bottom: 150px;
3942
margin-left: 30px;
4043
color: white;
44+
background-color: rgb(37, 100, 101);
4145
}

0 commit comments

Comments
ย (0)