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
LayoutSurveyFailure.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 "LayoutSurveyFailure.h" 00020 00021 LayoutSurveyFailure::LayoutSurveyFailure(DOGS102* lcd) 00022 : Layout(lcd), 00023 _lTitle(0, 1, "Survey Failed"), 00024 _lId(0, 0, "ID"), 00025 _lDr(8, 0, "DR"), 00026 _lPwr(13, 0, "P"), 00027 _fId(2, 0, 5), 00028 _fDr(10, 0, 2), 00029 _fPwr(14, 0, 2), 00030 _fGpsLat(0, 4, 17), 00031 _fGpsLon(0, 3, 17), 00032 _fGpsTime(0, 5, 17), 00033 _fInfo(0, 6, 17), 00034 _fSw1(9, 7, 8), 00035 _fSw2(0, 7, 8) 00036 {} 00037 00038 LayoutSurveyFailure::~LayoutSurveyFailure() {} 00039 00040 void LayoutSurveyFailure::display() { 00041 clear(); 00042 startUpdate(); 00043 00044 writeLabel(_lTitle); 00045 writeLabel(_lId); 00046 writeLabel(_lDr); 00047 writeLabel(_lPwr); 00048 00049 endUpdate(); 00050 } 00051 00052 void LayoutSurveyFailure::updateId(uint32_t id) { 00053 char buf[16]; 00054 size_t size; 00055 00056 size = snprintf(buf, sizeof(buf), "%lu", id); 00057 writeField(_fId, buf, size, true); 00058 } 00059 00060 void LayoutSurveyFailure::updateRate(std::string rate) { 00061 writeField(_fDr, rate, true); 00062 } 00063 00064 void LayoutSurveyFailure::updatePower(uint32_t power) { 00065 char buf[16]; 00066 size_t size; 00067 00068 size = snprintf(buf, sizeof(buf), "%lu", power); 00069 writeField(_fPwr, buf, size, true); 00070 } 00071 00072 void LayoutSurveyFailure::updateGpsLatitude(GPSPARSER::latitude lat) { 00073 char buf[32]; 00074 size_t size; 00075 00076 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", 00077 abs(lat.degrees), 00078 lat.minutes, 00079 (lat.seconds * 6) / 1000, 00080 (lat.seconds * 6) % 1000, 00081 (lat.degrees > 0) ? 'N' : 'S'); 00082 writeField(_fGpsLat, buf, size, true); 00083 } 00084 00085 void LayoutSurveyFailure::updateGpsLatitude(std::string msg) { 00086 writeField(_fGpsLat, msg, true); 00087 } 00088 00089 void LayoutSurveyFailure::updateGpsLongitude(GPSPARSER::longitude lon) { 00090 char buf[32]; 00091 size_t size; 00092 00093 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", 00094 abs(lon.degrees), 00095 lon.minutes, 00096 (lon.seconds * 6) / 1000, 00097 (lon.seconds * 6) % 1000, 00098 (lon.degrees > 0) ? 'E' : 'W'); 00099 writeField(_fGpsLon, buf, size, true); 00100 } 00101 00102 void LayoutSurveyFailure::updateGpsTime(struct tm time) { 00103 char buf[32]; 00104 size_t size; 00105 00106 size = snprintf(buf, sizeof(buf), "%02d:%02d %02d/%02d/%04d", 00107 time.tm_hour, 00108 time.tm_min, 00109 time.tm_mon + 1, 00110 time.tm_mday, 00111 time.tm_year + 1900); 00112 writeField(_fGpsTime, buf, size, true); 00113 } 00114 00115 void LayoutSurveyFailure::updateInfo(std::string info) { 00116 writeField(_fInfo, info, true); 00117 } 00118 00119 void LayoutSurveyFailure::updateSw1(std::string sw1) { 00120 writeField(_fSw1, sw1, true); 00121 } 00122 00123 void LayoutSurveyFailure::updateSw2(std::string sw2) { 00124 writeField(_fSw2, sw2, true); 00125 } 00126 00127 void LayoutSurveyFailure::updatePassFail(uint8_t pass, uint8_t fail) { 00128 char buf[32]; 00129 size_t size; 00130 00131 size = snprintf(buf, sizeof(buf), "Pass %u Fail %u", pass, fail); 00132 writeField(_fGpsTime, buf, size, true); 00133 } 00134
Generated on Tue Jul 12 2022 13:07:49 by 1.7.2