• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónc919edccde5350aeacbee1bff00e6911641fd2b6 (tree)
Tiempo2020-11-18 23:23:33
Autorkazuhiro_kondow <simauma.circus@gmai...>
Commiterkazuhiro_kondow

Log Message

Merge branch 'master' of git.pf.osdn.net:/gitroot/k/ka/kazuhiro_kondow/LoRa_Farm_IOT

Cambiar Resumen

Diferencia incremental

--- a/LoRaAgricultureSupportProject/.vscode/c_cpp_properties.json
+++ b/LoRaAgricultureSupportProject/.vscode/c_cpp_properties.json
@@ -4,7 +4,7 @@
44 "name": "Win32",
55 "browse": {
66 "path": [
7- "C:\\Users\\user1\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino",
7+ "C:\\Users\\user1\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.1\\cores\\arduino",
88 "C:\\Program Files (x86)\\Arduino\\libraries",
99 "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries",
1010 "C:\\Users\\user1\\Documents\\Arduino\\libraries",
@@ -18,7 +18,7 @@
1818 "${workspaceFolder}"
1919 ],
2020 "forcedInclude": [],
21- "intelliSenseMode": "msvc-x64",
21+ "intelliSenseMode": "${default}",
2222 "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
2323 "cStandard": "c11",
2424 "cppStandard": "c++17"
--- a/LoRaAgricultureSupportProject/UserLoRaCommon.h
+++ b/LoRaAgricultureSupportProject/UserLoRaCommon.h
@@ -52,6 +52,7 @@ typedef struct _st_standby_data
5252 {
5353 unsigned char msg_type;
5454 unsigned char unit_uuid[16];
55+ unsigned char node_type;
5556 float lon;
5657 float lat;
5758 } st_standby_data;
@@ -62,7 +63,7 @@ typedef struct _st_boiler_data
6263 unsigned char unit_uuid[16];
6364 unsigned char node_type;
6465 unsigned char node_status;
65- float temperature_val[4];
66+ float temperature_val[5];
6667 } st_boiler_data;
6768
6869 typedef struct _st_environ_data
--- a/LoRaAgricultureSupportProject/UserLoRaInterface.h
+++ b/LoRaAgricultureSupportProject/UserLoRaInterface.h
@@ -1,3 +1,4 @@
1+// 20200813 Serial.printの後にdelayを入れてコンソールへの送信時間を調整する事、蓄積するとデバイス側でResetが発生する
12 #ifndef UserLoRaInterface_h
23 #define UserLoRaInterface_h
34
@@ -17,7 +18,8 @@ bool sendUnitMsg(uint8_t *pBuffer, uint32_t length, unsigned char *pUuid, unsign
1718 // WAIT_RESPONSE_TIME unit:millis sec
1819 {
1920 //Send LoRa Data
20- Serial.println("sendUnitMsg");
21+ // Serial.println(F("SRT sendUnitMsg"));
22+ // delay(200);
2123 //Reply data array
2224 uni_respons_data buf;
2325 //reply data length
@@ -27,22 +29,26 @@ bool sendUnitMsg(uint8_t *pBuffer, uint32_t length, unsigned char *pUuid, unsign
2729 int retry_cnt= 0;
2830
2931 // for debug
30- Serial.println("Send LoRa Data : ");
31- delay(100);
32- for (int i = 0; i < length + 2; i++)
33- {
34- Serial.print(pBuffer[i], HEX);
35- Serial.print(",");
36- }
37- Serial.println("");
32+ // Serial.print(F("Data length : "));
33+ // Serial.println(length);
34+ // Serial.println(F("Send LoRa Data : "));
35+ // delay(100);
36+ // for (int i = 0; i < length + 2; i++)
37+ // {
38+ // Serial.print(pBuffer[i], HEX);
39+ // Serial.print(",");
40+ // }
41+ // Serial.println("");
42+ // delay(100);
3843
3944 unsigned long send_time = millis();
4045
4146 do{
4247 if(bRetryFlag)
4348 {
44- Serial.println("do send message"); // for debug
45- delay(100);
49+ // Serial.println(F("do send message")); // for debug
50+ // delay(150);
51+
4652 rf95.send(pBuffer, length + 2);
4753 // rf95 changing mode it idle
4854 rf95.waitPacketSent();
@@ -59,49 +65,65 @@ bool sendUnitMsg(uint8_t *pBuffer, uint32_t length, unsigned char *pUuid, unsign
5965 {
6066 if(buf.val.msg_type != (uint8_t)MSG_TYPE_RESPONSE)
6167 {
62- Serial.println("Check MSG_TYPE_RESPONSE :continue"); // for debug
68+ // Serial.println(F("Check MSG_TYPE_RESPONSE :continue")); // for debug
69+ // delay(100);
6370 continue;
6471 }
72+
6573 // Check receved reply UUID
66- if (memcmp(buf.val.unit_uuid, pUuid, (size_t)16) != 0)
74+ if (memcmp(buf.val.unit_uuid, pUuid, sizeof(*pUuid)) != 0)
6775 {
68- Serial.println("Check receved reply UUID :continue"); // for debug
76+ // Serial.println(F("Check receved reply UUID :continue")); // for debug
77+ // delay(100);
6978 continue;
7079 }
7180 else
7281 {
7382 if (buf.val.respons == 0x06)
7483 {
75- Serial.println("Replay ACK");
84+ // Serial.println(F("Replay ACK"));
85+ // Serial.print("u time:");
86+ // Serial.println(buf.val.unix_time_stamp_val);
87+ // delay(200);
7688 *rtime = buf.val.unix_time_stamp_val;
7789 break;
7890 }
7991 else if (buf.val.respons == 0x21)
8092 {
81- Serial.println("Replay NAK");
93+ Serial.println(F("Replay NAK"));
94+ delay(200);
8295 bRetryFlag = true;
8396 }
8497 else
8598 {
86- Serial.println("Replay Unkown");
99+ Serial.println(F("Replay Unkown"));
100+ delay(200);
87101 bRetryFlag = true;
88102 }
89103 }
90104 }
91105 else
92106 {
93- Serial.println("recv failed");
107+ Serial.println(F("Recv failed"));
108+ delay(100);
94109 bRetryFlag = true;
95110 }
96111 }
97112 else
98113 {
99- Serial.println("No reply, is rf95_server running?"); //No signal reply
114+ Serial.println(F("No Replay")); //No signal reply
115+ delay(200);
100116 bRetryFlag = true;
101117 }
102- bResultFlag = (((millis() - send_time) < WAIT_RESPONSE_TIME ) && (retry_cnt < SEND_RETRY_MAX));
118+
119+ unsigned long send_time2 = millis();
120+ bResultFlag = (((send_time2 - send_time) < WAIT_RESPONSE_TIME ) && (retry_cnt < SEND_RETRY_MAX));
121+
103122 }while(bResultFlag);
104123
124+ // Serial.println(F("END sendUnitMsg"));
125+ // delay(200);
126+
105127 return bResultFlag;
106128 }
107129