Revisión | c08321812daa81a14d7c85d36b0b55ea7a938d98 (tree) |
---|---|
Tiempo | 2020-11-18 23:05:43 |
Autor | kazuhiro_kondow <simauma.circus@gmai...> |
Commiter | kazuhiro_kondow |
コンソールログをFマクロに置き換え
@@ -78,7 +78,7 @@ void setup() | ||
78 | 78 | |
79 | 79 | void loop() |
80 | 80 | { |
81 | - Console.println(F("Start Listening ")); | |
81 | + Console.println("Start Listening "); | |
82 | 82 | //receive data buffer |
83 | 83 | uint8_t buf[MAX_DATA_SIZE]; |
84 | 84 | //data buffer length |
@@ -98,23 +98,11 @@ void loop() | ||
98 | 98 | // Listen Data from LoRa Node |
99 | 99 | if (rf95.waitAvailableTimeout(2000)) |
100 | 100 | { |
101 | - Console.println(F("Receive LoRa Message")); | |
101 | + Console.println("Receive LoRa Message"); | |
102 | 102 | // Check and Store Recive Sensor Data |
103 | 103 | if (rcvSensorData(buf,&len)) |
104 | 104 | { |
105 | - Console.println(F("Recive success")); | |
106 | - | |
107 | - // for debug | |
108 | - // Console.println(F("recevi data ")); | |
109 | - // Console.print(F("len:")); | |
110 | - // Console.println(len); | |
111 | - // Console.println(F("buf:")); | |
112 | - // for (int i = 0; i < len; i++) | |
113 | - // { | |
114 | - // Console.print(buf[i], HEX); | |
115 | - // Console.print(","); | |
116 | - // } | |
117 | - // Console.println(""); | |
105 | + Console.println("Recive success"); | |
118 | 106 | |
119 | 107 | // set MQTT Topics |
120 | 108 | int topics_type = 0; |
@@ -147,32 +135,32 @@ void loop() | ||
147 | 135 | switch(topics_type) |
148 | 136 | { |
149 | 137 | case 0: |
150 | - Console.println(F("None matching MQTT Topics!! Stop MQTT Publish.")); | |
138 | + Console.println("None matching MQTT Topics!! Stop MQTT Publish."); | |
151 | 139 | break; |
152 | 140 | case 1: |
153 | - Console.println(F("send MQTT_TOPICS_STANDBY.")); | |
141 | + Console.println("send MQTT_TOPICS_STANDBY."); | |
154 | 142 | runMQTTPub(postdata,F(MQTT_TOPICS_STANDBY)); |
155 | 143 | break; |
156 | 144 | case 2: |
157 | - Console.println(F("send MQTT_TOPICS_ENV.")); | |
145 | + Console.println("send MQTT_TOPICS_ENV."); | |
158 | 146 | runMQTTPub(postdata,F(MQTT_TOPICS_ENV)); |
159 | 147 | break; |
160 | 148 | case 3: |
161 | - Console.println(F("send MQTT_TOPICS_TRAP.")); | |
149 | + Console.println("send MQTT_TOPICS_TRAP."); | |
162 | 150 | runMQTTPub(postdata,F(MQTT_TOPICS_TRAP)); |
163 | 151 | break; |
164 | 152 | case 4: |
165 | - Console.println(F("send MQTT_TOPICS_BOILER.")); | |
153 | + Console.println("send MQTT_TOPICS_BOILER."); | |
166 | 154 | runMQTTPub(postdata,F(MQTT_TOPICS_BOILER)); |
167 | 155 | break; |
168 | 156 | default: |
169 | - Console.println(F("Switch Topics is None matching...")); | |
157 | + Console.println("Switch Topics is None matching..."); | |
170 | 158 | break; |
171 | 159 | } |
172 | 160 | } |
173 | 161 | else |
174 | 162 | { |
175 | - Console.println(F("Recive Failure")); | |
163 | + Console.println("Recive Failure"); | |
176 | 164 | } |
177 | 165 | } |
178 | 166 | } |
@@ -239,8 +227,8 @@ boolean rcvSensorData(uint8_t *buf,uint8_t *len) | ||
239 | 227 | } |
240 | 228 | else |
241 | 229 | { |
242 | - Console.println(F("Bat CRC")); | |
243 | - Console.println(F("Send Reply NAK")); | |
230 | + Console.println("Bat CRC"); | |
231 | + Console.println("Send Reply NAK"); | |
244 | 232 | result = false; |
245 | 233 | } |
246 | 234 |
@@ -286,18 +274,18 @@ void runMQTTPub(const char*param,const String & topics) | ||
286 | 274 | // Console.println(F("Called runMQTTPub.")); |
287 | 275 | |
288 | 276 | Process process; |
289 | - process.begin(F("mosquitto_pub")); | |
290 | - process.addParameter(F("-h")); | |
291 | - process.addParameter(F(MQTT_BROKER_URL)); | |
292 | - process.addParameter(F("-p")); | |
293 | - process.addParameter(F(MQTT_BROKER_PORT)); | |
294 | - process.addParameter(F("-u")); | |
295 | - process.addParameter(F(MQTT_USERNAME)); | |
296 | - process.addParameter(F("-P")); | |
297 | - process.addParameter(F(MQTT_PASSWORD)); | |
298 | - process.addParameter(F("-t")); | |
277 | + process.begin("mosquitto_pub"); | |
278 | + process.addParameter("-h"); | |
279 | + process.addParameter(MQTT_BROKER_URL); | |
280 | + process.addParameter("-p"); | |
281 | + process.addParameter(MQTT_BROKER_PORT); | |
282 | + process.addParameter("-u"); | |
283 | + process.addParameter(MQTT_USERNAME); | |
284 | + process.addParameter("-P"); | |
285 | + process.addParameter(MQTT_PASSWORD); | |
286 | + process.addParameter("-t"); | |
299 | 287 | process.addParameter(topics); |
300 | - process.addParameter(F("-m")); | |
288 | + process.addParameter("-m"); | |
301 | 289 | process.addParameter(param); |
302 | 290 | process.run(); |
303 | 291 |
@@ -307,18 +295,18 @@ void runMQTTPub(const char*param,const String & topics) | ||
307 | 295 | Console.print(c); |
308 | 296 | } |
309 | 297 | Console.println(""); |
310 | - Console.println(F("Process is not available!")); | |
298 | + Console.println("Process is not available!"); | |
311 | 299 | |
312 | 300 | Console.flush(); |
313 | 301 | } |
314 | 302 | |
315 | 303 | void runCurl() |
316 | 304 | { |
317 | - Console.println(F("Called runCurl.")); | |
305 | + Console.println("Called runCurl."); | |
318 | 306 | |
319 | 307 | Process process; |
320 | 308 | |
321 | - process.begin(F("curl")); | |
309 | + process.begin("curl"); | |
322 | 310 | process.addParameter(F(KickUrl)); |
323 | 311 | process.run(); |
324 | 312 |
@@ -328,7 +316,7 @@ void runCurl() | ||
328 | 316 | Console.print(c); |
329 | 317 | } |
330 | 318 | Console.println(""); |
331 | - Console.println(F("Process is not available!")); | |
319 | + Console.println("Process is not available!"); | |
332 | 320 | |
333 | 321 | Console.flush(); |
334 | 322 | } |
@@ -338,7 +326,7 @@ unsigned long runUnixTimeStamp() | ||
338 | 326 | { |
339 | 327 | Process process; |
340 | 328 | unsigned long unix_time_stamp_val = 0; |
341 | - process.begin(F("date")); | |
329 | + process.begin("date"); | |
342 | 330 | process.addParameter("+%s"); |
343 | 331 | process.run(); |
344 | 332 |