File tree Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,29 @@ static const byte SLEEPCMD[19] = {
32
32
0xAB // tail
33
33
};
34
34
35
+ static const byte WAKEUPCMD[19 ] = {
36
+ 0xAA , // head
37
+ 0xB4 , // command id
38
+ 0x06 , // data byte 1
39
+ 0x01 , // data byte 2 (set mode)
40
+ 0x01 , // data byte 3 (work)
41
+ 0x00 , // data byte 4
42
+ 0x00 , // data byte 5
43
+ 0x00 , // data byte 6
44
+ 0x00 , // data byte 7
45
+ 0x00 , // data byte 8
46
+ 0x00 , // data byte 9
47
+ 0x00 , // data byte 10
48
+ 0x00 , // data byte 11
49
+ 0x00 , // data byte 12
50
+ 0x00 , // data byte 13
51
+ 0xFF , // data byte 14 (device id byte 1)
52
+ 0xFF , // data byte 15 (device id byte 2)
53
+ 0x06 , // checksum
54
+ 0xAB // tail
55
+ };
56
+
57
+
35
58
SDS011::SDS011 (void ) {
36
59
37
60
}
@@ -92,8 +115,15 @@ void SDS011::sleep() {
92
115
// SDS011:wakeup
93
116
// --------------------------------------------------------
94
117
void SDS011::wakeup () {
95
- sds_data->write (0x01 );
96
- sds_data->flush ();
118
+ // sds_data->write(0x01);
119
+ // sds_data->flush();
120
+ for (uint8_t i = 0 ; i < 19 ; i++) {
121
+ sds_data->write (WAKEUPCMD[i]);
122
+ }
123
+ sds_data->flush ();
124
+ while (sds_data->available () > 0 ) {
125
+ sds_data->read ();
126
+ }
97
127
}
98
128
99
129
#ifndef ESP32
You can’t perform that action at this time.
0 commit comments