Custom Channel Plan version of MTDOT Box firmware
Dependencies: DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-Custom mDot_Channel_Plans
Fork of MTDOT-BOX-EVB-Factory-Firmware by
LayoutSurveyGps.cpp
00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #include "LayoutSurveyGps.h" 00020 LayoutSurveyGps::LayoutSurveyGps(DOGS102* lcd, uint8_t band) 00021 : Layout(lcd), 00022 _band(band), 00023 _lDR(8,0,"DR"), 00024 _lFSB(0,0,"FSB"), 00025 _lTemp(8,6,"Temp "), 00026 _lPower(13,0,"P"), 00027 _lPadding(0,6,"Pad"), 00028 _fDr(10,0,2), 00029 _fSw1(13,7,4), 00030 _fSw2(0,7,9), 00031 _fFSB(3,0,1), 00032 _fTemp(13,6,4), 00033 _fPower(14,0,2), 00034 _fNoLink(0,1,17), 00035 _fGpsLat(0,3,17), 00036 _fGpsLon(0,4,17), 00037 _fGpsTime(0,5,17), 00038 _fDownSnr(12,2,5), 00039 _fPadding(4,6,3), 00040 _fDownRssi(0,2,12) 00041 {} 00042 00043 LayoutSurveyGps::~LayoutSurveyGps() {} 00044 00045 void LayoutSurveyGps::display() {} 00046 00047 void LayoutSurveyGps::initial(){ 00048 writeField(_fNoLink, string(" "), true); 00049 } 00050 00051 void LayoutSurveyGps::display(bool success, mDot::snr_stats snr, mDot::rssi_stats rssi, int power, int fsb, int padding, int dr){ 00052 char buf[17]; 00053 size_t size; 00054 clear(); 00055 startUpdate(); 00056 writeLabel(_lDR); 00057 writeLabel(_lTemp); 00058 writeLabel(_lPower); 00059 writeLabel(_lPadding); 00060 writeLabel(_lFSB); 00061 00062 if(success) { 00063 size = snprintf(buf, sizeof(buf), "DWN %3d dbm", rssi.last); 00064 writeField(_fDownRssi, buf, size); 00065 00066 memset(buf, 0, sizeof(buf)); 00067 size = snprintf(buf, sizeof(buf), " %2.1f", snr.last / 10.0); 00068 writeField(_fDownSnr, buf, size); 00069 } else { 00070 writeField(_fNoLink,string("Send Failed"),true); 00071 } 00072 00073 memset(buf, 0, sizeof(buf)); 00074 size = snprintf(buf, sizeof(buf), "%d", dr); 00075 writeField(_fDr, buf, size, true); 00076 00077 memset(buf, 0, sizeof(buf)); 00078 size = snprintf(buf, sizeof(buf), "%d", power); 00079 writeField(_fPower, buf, size, true); 00080 00081 memset(buf, 0, sizeof(buf)); 00082 size = snprintf(buf, sizeof(buf), "%d", fsb); 00083 writeField(_fFSB, buf, size, true); 00084 00085 memset(buf, 0, sizeof(buf)); 00086 size = snprintf(buf, sizeof(buf), "%d", padding); 00087 writeField(_fPadding, buf, size, true); 00088 endUpdate(); 00089 } 00090 00091 void LayoutSurveyGps::updateSw1(string Sw1, string Sw2){ 00092 string temp; 00093 for(int i = Sw1.size(); i<4; i++){ 00094 temp+=" "; 00095 } 00096 temp+=Sw1; 00097 writeField(_fSw1, temp, true); 00098 } 00099 00100 void LayoutSurveyGps::updateSw2(string Sw2){ 00101 writeField(_fSw2, Sw2, true); 00102 } 00103 00104 void LayoutSurveyGps::sending(){ 00105 clear(); 00106 writeField(_fGpsLat,string(" Sending..."),true); 00107 } 00108 00109 void LayoutSurveyGps::sendResult(string str){ 00110 clear(); 00111 writeField(_fGpsLat,str,true); 00112 } 00113 00114 void LayoutSurveyGps::updateNextCh(int count_down){ 00115 clear(); 00116 size_t size; 00117 char buf[17]; 00118 size = snprintf(buf, sizeof(buf), "Countdown:%d", count_down); 00119 writeField(_fGpsTime, buf, size, true); 00120 writeField(_fGpsLon, string("No Free Channel"), true); 00121 } 00122 00123 void LayoutSurveyGps::updateStats(bool GPS, GPSPARSER::longitude lon, GPSPARSER::latitude lat, struct tm time, float temp){ 00124 char buf[17]; 00125 size_t size; 00126 startUpdate(); 00127 00128 if(GPS) { 00129 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", 00130 abs(lon.degrees), 00131 lon.minutes, 00132 (lon.seconds * 6) / 1000, 00133 (lon.seconds * 6) % 1000, 00134 (lon.degrees > 0) ? 'E' : 'W'); 00135 writeField(_fGpsLon, buf, size, true); 00136 00137 memset(buf, 0, sizeof(buf)); 00138 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", 00139 abs(lat.degrees), 00140 lat.minutes, 00141 (lat.seconds * 6) / 1000, 00142 (lat.seconds * 6) % 1000, 00143 (lat.degrees > 0) ? 'N' : 'S'); 00144 writeField(_fGpsLat, buf, size, true); 00145 00146 memset(buf, 0, sizeof(buf)); 00147 size = snprintf(buf, sizeof(buf), "%02d:%02d %02d/%02d/%04d", 00148 time.tm_hour, 00149 time.tm_min, 00150 time.tm_mon + 1, 00151 time.tm_mday, 00152 time.tm_year + 1900); 00153 writeField(_fGpsTime, buf, size, true); 00154 00155 } else { 00156 writeField(_fGpsLon, string("No Gps Lock"), true); 00157 } 00158 memset(buf, 0, sizeof(buf)); 00159 size = snprintf(buf, sizeof(buf), "%.1f", temp); 00160 writeField(_fTemp, buf, size, true); 00161 endUpdate(); 00162 }
Generated on Tue Jul 12 2022 13:07:49 by 1.7.2