Custom "Installer Assistant" software. Modified Single Sweep Mode. Goes right into single sweep mode upon power-up and displays signal strength. Works with mbed-os 5.1.2 and mdot lib 5.1.5

Dependencies:   DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-dev-mbed5-deprecated

Fork of MTDOT-BOX-EVB-Factory-Firmware by MultiTech

Committer:
Mike Fiore
Date:
Fri Nov 04 17:27:05 2016 -0500
Revision:
7:a31236c2e75c
update from git revision 2.1.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 7:a31236c2e75c 1 /* Copyright (c) <2016> <MultiTech Systems>, MIT License
Mike Fiore 7:a31236c2e75c 2 *
Mike Fiore 7:a31236c2e75c 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Mike Fiore 7:a31236c2e75c 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
Mike Fiore 7:a31236c2e75c 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
Mike Fiore 7:a31236c2e75c 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
Mike Fiore 7:a31236c2e75c 7 * furnished to do so, subject to the following conditions:
Mike Fiore 7:a31236c2e75c 8 *
Mike Fiore 7:a31236c2e75c 9 * The above copyright notice and this permission notice shall be included in all copies or
Mike Fiore 7:a31236c2e75c 10 * substantial portions of the Software.
Mike Fiore 7:a31236c2e75c 11 *
Mike Fiore 7:a31236c2e75c 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Mike Fiore 7:a31236c2e75c 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Mike Fiore 7:a31236c2e75c 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Mike Fiore 7:a31236c2e75c 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Mike Fiore 7:a31236c2e75c 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Mike Fiore 7:a31236c2e75c 17 */
Mike Fiore 7:a31236c2e75c 18
Mike Fiore 7:a31236c2e75c 19 #include "LayoutSurveyGps.h"
Mike Fiore 7:a31236c2e75c 20 LayoutSurveyGps::LayoutSurveyGps(DOGS102* lcd, uint8_t band)
Mike Fiore 7:a31236c2e75c 21 : Layout(lcd),
Mike Fiore 7:a31236c2e75c 22 _band(band),
Mike Fiore 7:a31236c2e75c 23 _lDR(8,0,"DR"),
Mike Fiore 7:a31236c2e75c 24 _lFSB(0,0,"FSB"),
Mike Fiore 7:a31236c2e75c 25 _lTemp(8,6,"Temp "),
Mike Fiore 7:a31236c2e75c 26 _lPower(13,0,"P"),
Mike Fiore 7:a31236c2e75c 27 _lPadding(0,6,"Pad"),
Mike Fiore 7:a31236c2e75c 28 _fDr(10,0,2),
Mike Fiore 7:a31236c2e75c 29 _fSw1(13,7,4),
Mike Fiore 7:a31236c2e75c 30 _fSw2(0,7,9),
Mike Fiore 7:a31236c2e75c 31 _fFSB(3,0,1),
Mike Fiore 7:a31236c2e75c 32 _fTemp(13,6,4),
Mike Fiore 7:a31236c2e75c 33 _fPower(14,0,2),
Mike Fiore 7:a31236c2e75c 34 _fNoLink(0,1,17),
Mike Fiore 7:a31236c2e75c 35 _fGpsLat(0,3,17),
Mike Fiore 7:a31236c2e75c 36 _fGpsLon(0,4,17),
Mike Fiore 7:a31236c2e75c 37 _fGpsTime(0,5,17),
Mike Fiore 7:a31236c2e75c 38 _fDownSnr(12,2,5),
Mike Fiore 7:a31236c2e75c 39 _fPadding(4,6,3),
Mike Fiore 7:a31236c2e75c 40 _fDownRssi(0,2,12)
Mike Fiore 7:a31236c2e75c 41 {}
Mike Fiore 7:a31236c2e75c 42
Mike Fiore 7:a31236c2e75c 43 LayoutSurveyGps::~LayoutSurveyGps() {}
Mike Fiore 7:a31236c2e75c 44
Mike Fiore 7:a31236c2e75c 45 void LayoutSurveyGps::display() {}
Mike Fiore 7:a31236c2e75c 46
Mike Fiore 7:a31236c2e75c 47 void LayoutSurveyGps::initial(){
Mike Fiore 7:a31236c2e75c 48 writeField(_fNoLink, string(" "), true);
Mike Fiore 7:a31236c2e75c 49 }
Mike Fiore 7:a31236c2e75c 50
Mike Fiore 7:a31236c2e75c 51 void LayoutSurveyGps::display(bool success, mDot::snr_stats snr, mDot::rssi_stats rssi, int power, int fsb, int padding, int dr){
Mike Fiore 7:a31236c2e75c 52 char buf[17];
Mike Fiore 7:a31236c2e75c 53 size_t size;
Mike Fiore 7:a31236c2e75c 54 clear();
Mike Fiore 7:a31236c2e75c 55 startUpdate();
Mike Fiore 7:a31236c2e75c 56 writeLabel(_lDR);
Mike Fiore 7:a31236c2e75c 57 writeLabel(_lTemp);
Mike Fiore 7:a31236c2e75c 58 writeLabel(_lPower);
Mike Fiore 7:a31236c2e75c 59 writeLabel(_lPadding);
Mike Fiore 7:a31236c2e75c 60
Mike Fiore 7:a31236c2e75c 61 if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) {
Mike Fiore 7:a31236c2e75c 62 writeLabel(_lFSB);
Mike Fiore 7:a31236c2e75c 63 }
Mike Fiore 7:a31236c2e75c 64 if(success) {
Mike Fiore 7:a31236c2e75c 65 size = snprintf(buf, sizeof(buf), "DWN %3d dbm", rssi.last);
Mike Fiore 7:a31236c2e75c 66 writeField(_fDownRssi, buf, size);
Mike Fiore 7:a31236c2e75c 67
Mike Fiore 7:a31236c2e75c 68 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 69 size = snprintf(buf, sizeof(buf), " %2.1f", snr.last / 10.0);
Mike Fiore 7:a31236c2e75c 70 writeField(_fDownSnr, buf, size);
Mike Fiore 7:a31236c2e75c 71 } else {
Mike Fiore 7:a31236c2e75c 72 writeField(_fNoLink,string("Send Failed"),true);
Mike Fiore 7:a31236c2e75c 73 }
Mike Fiore 7:a31236c2e75c 74
Mike Fiore 7:a31236c2e75c 75 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 76 size = snprintf(buf, sizeof(buf), "%d", dr);
Mike Fiore 7:a31236c2e75c 77 writeField(_fDr, buf, size, true);
Mike Fiore 7:a31236c2e75c 78
Mike Fiore 7:a31236c2e75c 79 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 80 size = snprintf(buf, sizeof(buf), "%d", power);
Mike Fiore 7:a31236c2e75c 81 writeField(_fPower, buf, size, true);
Mike Fiore 7:a31236c2e75c 82
Mike Fiore 7:a31236c2e75c 83 if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) {
Mike Fiore 7:a31236c2e75c 84 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 85 size = snprintf(buf, sizeof(buf), "%d", fsb);
Mike Fiore 7:a31236c2e75c 86 writeField(_fFSB, buf, size, true);
Mike Fiore 7:a31236c2e75c 87 }
Mike Fiore 7:a31236c2e75c 88
Mike Fiore 7:a31236c2e75c 89 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 90 size = snprintf(buf, sizeof(buf), "%d", padding);
Mike Fiore 7:a31236c2e75c 91 writeField(_fPadding, buf, size, true);
Mike Fiore 7:a31236c2e75c 92 endUpdate();
Mike Fiore 7:a31236c2e75c 93 }
Mike Fiore 7:a31236c2e75c 94
Mike Fiore 7:a31236c2e75c 95 void LayoutSurveyGps::updateSw1(string Sw1, string Sw2){
Mike Fiore 7:a31236c2e75c 96 string temp;
Mike Fiore 7:a31236c2e75c 97 for(int i = Sw1.size(); i<4; i++){
Mike Fiore 7:a31236c2e75c 98 temp+=" ";
Mike Fiore 7:a31236c2e75c 99 }
Mike Fiore 7:a31236c2e75c 100 temp+=Sw1;
Mike Fiore 7:a31236c2e75c 101 writeField(_fSw1, temp, true);
Mike Fiore 7:a31236c2e75c 102 }
Mike Fiore 7:a31236c2e75c 103
Mike Fiore 7:a31236c2e75c 104 void LayoutSurveyGps::updateSw2(string Sw2){
Mike Fiore 7:a31236c2e75c 105 writeField(_fSw2, Sw2, true);
Mike Fiore 7:a31236c2e75c 106 }
Mike Fiore 7:a31236c2e75c 107
Mike Fiore 7:a31236c2e75c 108 void LayoutSurveyGps::sending(){
Mike Fiore 7:a31236c2e75c 109 clear();
Mike Fiore 7:a31236c2e75c 110 writeField(_fGpsLat,string(" Sending..."),true);
Mike Fiore 7:a31236c2e75c 111 }
Mike Fiore 7:a31236c2e75c 112
Mike Fiore 7:a31236c2e75c 113 void LayoutSurveyGps::sendResult(string str){
Mike Fiore 7:a31236c2e75c 114 clear();
Mike Fiore 7:a31236c2e75c 115 writeField(_fGpsLat,str,true);
Mike Fiore 7:a31236c2e75c 116 }
Mike Fiore 7:a31236c2e75c 117
Mike Fiore 7:a31236c2e75c 118 void LayoutSurveyGps::updateNextCh(int count_down){
Mike Fiore 7:a31236c2e75c 119 clear();
Mike Fiore 7:a31236c2e75c 120 size_t size;
Mike Fiore 7:a31236c2e75c 121 char buf[17];
Mike Fiore 7:a31236c2e75c 122 size = snprintf(buf, sizeof(buf), "Countdown:%d", count_down);
Mike Fiore 7:a31236c2e75c 123 writeField(_fGpsTime, buf, size, true);
Mike Fiore 7:a31236c2e75c 124 writeField(_fGpsLon, string("No Free Channel"), true);
Mike Fiore 7:a31236c2e75c 125 }
Mike Fiore 7:a31236c2e75c 126
Mike Fiore 7:a31236c2e75c 127 void LayoutSurveyGps::updateStats(bool GPS, GPSPARSER::longitude lon, GPSPARSER::latitude lat, struct tm time, float temp){
Mike Fiore 7:a31236c2e75c 128 char buf[17];
Mike Fiore 7:a31236c2e75c 129 size_t size;
Mike Fiore 7:a31236c2e75c 130 startUpdate();
Mike Fiore 7:a31236c2e75c 131
Mike Fiore 7:a31236c2e75c 132 if(GPS) {
Mike Fiore 7:a31236c2e75c 133 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c",
Mike Fiore 7:a31236c2e75c 134 abs(lon.degrees),
Mike Fiore 7:a31236c2e75c 135 lon.minutes,
Mike Fiore 7:a31236c2e75c 136 (lon.seconds * 6) / 1000,
Mike Fiore 7:a31236c2e75c 137 (lon.seconds * 6) % 1000,
Mike Fiore 7:a31236c2e75c 138 (lon.degrees > 0) ? 'E' : 'W');
Mike Fiore 7:a31236c2e75c 139 writeField(_fGpsLon, buf, size, true);
Mike Fiore 7:a31236c2e75c 140
Mike Fiore 7:a31236c2e75c 141 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 142 size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c",
Mike Fiore 7:a31236c2e75c 143 abs(lat.degrees),
Mike Fiore 7:a31236c2e75c 144 lat.minutes,
Mike Fiore 7:a31236c2e75c 145 (lat.seconds * 6) / 1000,
Mike Fiore 7:a31236c2e75c 146 (lat.seconds * 6) % 1000,
Mike Fiore 7:a31236c2e75c 147 (lat.degrees > 0) ? 'N' : 'S');
Mike Fiore 7:a31236c2e75c 148 writeField(_fGpsLat, buf, size, true);
Mike Fiore 7:a31236c2e75c 149
Mike Fiore 7:a31236c2e75c 150 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 151 size = snprintf(buf, sizeof(buf), "%02d:%02d %02d/%02d/%04d",
Mike Fiore 7:a31236c2e75c 152 time.tm_hour,
Mike Fiore 7:a31236c2e75c 153 time.tm_min,
Mike Fiore 7:a31236c2e75c 154 time.tm_mon + 1,
Mike Fiore 7:a31236c2e75c 155 time.tm_mday,
Mike Fiore 7:a31236c2e75c 156 time.tm_year + 1900);
Mike Fiore 7:a31236c2e75c 157 writeField(_fGpsTime, buf, size, true);
Mike Fiore 7:a31236c2e75c 158
Mike Fiore 7:a31236c2e75c 159 } else {
Mike Fiore 7:a31236c2e75c 160 writeField(_fGpsLon, string("No Gps Lock"), true);
Mike Fiore 7:a31236c2e75c 161 }
Mike Fiore 7:a31236c2e75c 162 memset(buf, 0, sizeof(buf));
Mike Fiore 7:a31236c2e75c 163 size = snprintf(buf, sizeof(buf), "%.1f", temp);
Mike Fiore 7:a31236c2e75c 164 writeField(_fTemp, buf, size, true);
Mike Fiore 7:a31236c2e75c 165 endUpdate();
Mike Fiore 7:a31236c2e75c 166 }