Fix sensor number and identations

This commit is contained in:
Adrian Scillato 2019-12-17 01:40:56 -03:00 committed by GitHub
parent 1a02f52de9
commit ed92cdc74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@
Version Date Action Description Version Date Action Description
-------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------
0.9.1.0 20191216 integrate - Added pin specifications from Tasmota WEB UI 0.9.1.0 20191216 integrate - Added pin specifications from Tasmota WEB UI. Minor tweaks.
--- ---
0.9.0.0 20190817 started - further development by Christian Baars - https://github.com/Staars/Sonoff-Tasmota 0.9.0.0 20190817 started - further development by Christian Baars - https://github.com/Staars/Sonoff-Tasmota
forked - from arendst/tasmota - https://github.com/arendst/Sonoff-Tasmota forked - from arendst/tasmota - https://github.com/arendst/Sonoff-Tasmota
@ -299,17 +299,6 @@ void UBXinitCFG(void){
UBXSerial->write( pgm_read_byte(UBLOX_INIT+i) ); UBXSerial->write( pgm_read_byte(UBLOX_INIT+i) );
} }
DEBUG_SENSOR_LOG(PSTR("UBX: turn off NMEA")); DEBUG_SENSOR_LOG(PSTR("UBX: turn off NMEA"));
/*
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"),
Settings.knx_GA_registered,
device_param_ga[GAop-1],
GA_FNUM, GA_AREA, GA_FDEF );
*/
} }
void UBXTriggerTele(void){ void UBXTriggerTele(void){
@ -435,11 +424,10 @@ uint32_t UBXprocessGPS() {
} }
} }
// DEBUG_SENSOR_LOG(PSTR("UBX: got none or unknown Message")); // DEBUG_SENSOR_LOG(PSTR("UBX: got none or unknown Message"));
if(data_bytes!=0){ if(data_bytes!=0) {
UBX.state.non_empty_loops++; UBX.state.non_empty_loops++;
DEBUG_SENSOR_LOG(PSTR("UBX: got %u bytes, non-empty-loop: %u"), data_bytes, UBX.state.non_empty_loops); DEBUG_SENSOR_LOG(PSTR("UBX: got %u bytes, non-empty-loop: %u"), data_bytes, UBX.state.non_empty_loops);
} } else {
else{
UBX.state.non_empty_loops = 0; // now a hidden GPS-device reset is unlikely UBX.state.non_empty_loops = 0; // now a hidden GPS-device reset is unlikely
} }
return MT_NONE; return MT_NONE;
@ -449,7 +437,7 @@ uint32_t UBXprocessGPS() {
| * callback functions for the download | * callback functions for the download
\*********************************************************************************************/ \*********************************************************************************************/
#ifdef USE_FLOG #ifdef USE_FLOG
void UBXsendHeader(void){ void UBXsendHeader(void) {
WebServer->setContentLength(CONTENT_LENGTH_UNKNOWN); WebServer->setContentLength(CONTENT_LENGTH_UNKNOWN);
WebServer->sendHeader(F("Content-Disposition"), F("attachment; filename=TASMOTA.gpx")); WebServer->sendHeader(F("Content-Disposition"), F("attachment; filename=TASMOTA.gpx"));
WSSend(200, CT_STREAM, F( WSSend(200, CT_STREAM, F(
@ -541,6 +529,7 @@ void UBXSelectMode(uint16_t mode){
} }
AddLog_P(LOG_LEVEL_INFO, PSTR("UBX: stop recording")); AddLog_P(LOG_LEVEL_INFO, PSTR("UBX: stop recording"));
break; break;
#endif //USE_FLOG
case 7: case 7:
UBX.mode.send_when_new = 1; // send mqtt on new postion + TELE -> consider to set TELE to a very high value UBX.mode.send_when_new = 1; // send mqtt on new postion + TELE -> consider to set TELE to a very high value
break; break;
@ -565,9 +554,6 @@ void UBXSelectMode(uint16_t mode){
Settings.latitude = UBX.state.last_lat; Settings.latitude = UBX.state.last_lat;
Settings.longitude = UBX.state.last_lon; Settings.longitude = UBX.state.last_lon;
break; break;
#endif //USE_FLOG
default: default:
if(mode>1000 && mode <1066) { if(mode>1000 && mode <1066) {
// UBXSetRate(mode-1000); // min. 1001 = 0.001 Hz, but will be converted to 1/65535 anyway ~0.015 Hz, max. 2000 = 1.000 Hz // UBXSetRate(mode-1000); // min. 1001 = 0.001 Hz, but will be converted to 1/65535 anyway ~0.015 Hz, max. 2000 = 1.000 Hz
@ -601,8 +587,7 @@ bool UBXHandlePOSLLH(){
UBXTriggerTele(); UBXTriggerTele();
} }
return true; // new position return true; // new position
} } else {
else {
DEBUG_SENSOR_LOG(PSTR("UBX: no valid position data")); DEBUG_SENSOR_LOG(PSTR("UBX: no valid position data"));
} }
return false; // no GPS-fix return false; // no GPS-fix
@ -617,6 +602,7 @@ void UBXHandleSTATUS(){
UBX.state.gpsFix = 0; // without valid flag, everything is "no fix" UBX.state.gpsFix = 0; // without valid flag, everything is "no fix"
} }
} }
void UBXHandleTIME(){ void UBXHandleTIME(){
DEBUG_SENSOR_LOG(PSTR("UBX: UTC-Time: %u-%u-%u %u:%u:%u"),UBX.Message.navTime.year, UBX.Message.navTime.month ,UBX.Message.navTime.day,UBX.Message.navTime.hour,UBX.Message.navTime.min,UBX.Message.navTime.sec); DEBUG_SENSOR_LOG(PSTR("UBX: UTC-Time: %u-%u-%u %u:%u:%u"),UBX.Message.navTime.year, UBX.Message.navTime.month ,UBX.Message.navTime.day,UBX.Message.navTime.hour,UBX.Message.navTime.min,UBX.Message.navTime.sec);
if(UBX.Message.navTime.valid.UTC){ if(UBX.Message.navTime.valid.UTC){
@ -636,7 +622,8 @@ void UBXHandleTIME(){
} }
} }
void UBXHandleOther(void){ void UBXHandleOther(void)
{
if(UBX.state.non_empty_loops>6){ // we expect only 4-5 non-empty loops in a row, could change with other sensor speed (Hz) if(UBX.state.non_empty_loops>6){ // we expect only 4-5 non-empty loops in a row, could change with other sensor speed (Hz)
UBXinitCFG(); // this should only happen with lots of NMEA-messages, but it is only a guess!! UBXinitCFG(); // this should only happen with lots of NMEA-messages, but it is only a guess!!
AddLog_P(LOG_LEVEL_ERROR, PSTR("UBX: possible device-reset, will re-init")); AddLog_P(LOG_LEVEL_ERROR, PSTR("UBX: possible device-reset, will re-init"));
@ -647,7 +634,8 @@ void UBXHandleOther(void){
/********************************************************************************************/ /********************************************************************************************/
void UBXTimeServer(){ void UBXTimeServer()
{
if(UBX.mode.runningNTP){ if(UBX.mode.runningNTP){
timeServer.processOneRequest(Rtc.utc_time, UBX.state.last_iTOW%1000); timeServer.processOneRequest(Rtc.utc_time, UBX.state.last_iTOW%1000);
} }
@ -752,8 +740,7 @@ void UBXShow(bool json)
if(UBX.mode.send_UI_only){ if(UBX.mode.send_UI_only){
uint32_t i = UBX.state.log_interval / 10; uint32_t i = UBX.state.log_interval / 10;
ResponseAppend_P(PSTR("\"fil\":%u,\"int\":%u}"),UBX.mode.filter_noise, i); ResponseAppend_P(PSTR("\"fil\":%u,\"int\":%u}"),UBX.mode.filter_noise, i);
} } else {
else{
ResponseAppend_P(PSTR("\"lat\":%s,\"lon\":%s,\"height\":%s,\"hAcc\":%s,\"vAcc\":%s}"), lat, lon, height, hAcc, vAcc); ResponseAppend_P(PSTR("\"lat\":%s,\"lon\":%s,\"height\":%s,\"hAcc\":%s,\"vAcc\":%s}"), lat, lon, height, hAcc, vAcc);
} }
#ifdef USE_FLOG #ifdef USE_FLOG
@ -817,7 +804,7 @@ bool Xsns58(uint8_t function)
UBXDetect(); UBXDetect();
break; break;
case FUNC_COMMAND_SENSOR: case FUNC_COMMAND_SENSOR:
if (XSNS_92 == XdrvMailbox.index){ if (XSNS_58 == XdrvMailbox.index){
result = UBXCmd(); result = UBXCmd();
} }
break; break;