@@ -115,24 +115,37 @@ void sfeIoTNodeLoRaWAN::displayAppStatus(bool useInfo)
115
115
flxSerial.textToWhite ();
116
116
flxLog_N (" System:" );
117
117
flxSerial.textToNormal ();
118
+ flxSerial.flush ();
118
119
}
119
- // if (_theSDCard.enabled())
120
- // {
121
-
122
- // char szSize[32];
123
- // char szCap[32];
124
- // char szAvail[32];
125
-
126
- // flx_utils::formatByteString(_theSDCard.size(), 2, szSize, sizeof(szSize));
127
- // flx_utils::formatByteString(_theSDCard.total(), 2, szCap, sizeof(szCap));
128
- // flx_utils::formatByteString(_theSDCard.total() - _theSDCard.used(), 2, szAvail, sizeof(szAvail));
120
+ if (_theSDCard.enabled ())
121
+ {
129
122
130
- // flxLog__(logLevel, "%cSD Card - Type: %s Size: %s Capacity: %s Free: %s (%.1f%%)", pre_ch,
131
- // _theSDCard.type(),
132
- // szSize, szCap, szAvail, 100. - (_theSDCard.used() / (float)_theSDCard.total() * 100.));
133
- // }
134
- // else
135
- // flxLog__(logLevel, "%cSD card not available", pre_ch);
123
+ char szSize[32 ];
124
+ char szCap[32 ];
125
+ char szAvail[32 ];
126
+
127
+ uint64_t sd_size = _theSDCard.size ();
128
+ uint64_t sd_total = _theSDCard.total ();
129
+
130
+ flx_utils::formatByteString (sd_size, 2 , szSize, sizeof (szSize));
131
+ flx_utils::formatByteString (sd_total, 2 , szCap, sizeof (szCap));
132
+
133
+ flxLog___ (logLevel, " %cSD Card - Type: %s Size: %s Capacity: %s " , pre_ch, _theSDCard.type (), szSize, szCap);
134
+
135
+ // Getting about used can take time -- so only do if about is called (use info is false)
136
+ if (!useInfo)
137
+ {
138
+ flxLog_N_ (" ..." );
139
+ flxSerial.flush ();
140
+ // This call can take some time .. .so
141
+ uint64_t sd_used = _theSDCard.used ();
142
+ flx_utils::formatByteString (sd_total - sd_used, 2 , szAvail, sizeof (szAvail));
143
+ flxLog_N (" Free: %s (%.1f%%)" , szAvail, 100 . - (sd_used / (float )sd_total * 100 .));
144
+ }else
145
+ flxLog_N (" " );
146
+ }
147
+ else
148
+ flxLog__ (logLevel, " %cSD card not available" , pre_ch);
136
149
137
150
// show heap level
138
151
flxLog__ (logLevel, " %cSystem Heap - Total: %dB Free: %dB (%.1f%%)" , pre_ch, flxPlatform::heap_size (),
@@ -167,15 +180,15 @@ void sfeIoTNodeLoRaWAN::displayAppStatus(bool useInfo)
167
180
flxLog__ (logLevel, " %cJSON Buffer - Size: %dB Max Used: %dB" , pre_ch, jsonBufferSize (), _fmtJSON.getMaxSizeUsed ());
168
181
flxLog__ (logLevel, " %cSerial Output: %s" , pre_ch, kLogFormatNames [serialLogType ()]);
169
182
flxLog_N (" %c Baud Rate: %d" , pre_ch, serialBaudRate ());
183
+ flxLog__ (logLevel, " %cSD Card Output: %s" , pre_ch, kLogFormatNames [sdCardLogType ()]);
170
184
171
185
// flxLog__(logLevel, "%cSD Card Output: %s", pre_ch, kLogFormatNames[sdCardLogType()]);
172
186
173
187
// at startup, useInfo == true, the file isn't known, so skip output
174
- // if (!useInfo)
175
- // flxLog_N("%c Current Filename: \t%s", pre_ch,
176
- // _theOutputFile.currentFilename().length() == 0 ? "<none>" :
177
- // _theOutputFile.currentFilename().c_str());
178
- // flxLog_N("%c Rotate Period: %d Hours", pre_ch, _theOutputFile.rotatePeriod());
188
+ if (!useInfo)
189
+ flxLog_N (" %c Current Filename: \t %s" , pre_ch,
190
+ _theOutputFile.currentFilename ().length () == 0 ? " <none>" : _theOutputFile.currentFilename ().c_str ());
191
+ flxLog_N (" %c Rotate Period: %d Hours" , pre_ch, _theOutputFile.rotatePeriod ());
179
192
180
193
flxLog_N (" " );
181
194
0 commit comments