added GFSK

This commit is contained in:
2026-07-06 13:13:14 +03:00
parent 11e8ee8d7f
commit 4388408ef8
8 changed files with 164 additions and 9 deletions
@@ -7,4 +7,5 @@ public class TrackInfo {
public Double ended_at;
public String label;
public int point_count;
public String modem_mode;
}
@@ -46,6 +46,8 @@ import com.grigowashere.loratester.location.GeoUtils;
import com.grigowashere.loratester.net.NetworkMonitor;
import com.grigowashere.loratester.map.EsriWorldImagery;
import com.grigowashere.loratester.model.RadioSnapshot;
import com.grigowashere.loratester.telnet.LoraStatsFormatter;
import com.grigowashere.loratester.telnet.ModemMode;
import com.grigowashere.loratester.telnet.StatsExtractor;
import com.grigowashere.loratester.track.TrackRecorder;
@@ -776,7 +778,8 @@ public class MapFragment extends Fragment {
String title = info.label != null && !info.label.isBlank()
? info.label
: ("Репер #" + info.id);
labels[i] = "#" + info.id + " · " + title;
String mode = modemModeSuffix(modemModeFromReference(info));
labels[i] = "#" + info.id + mode + " · " + title;
checked[i] = selected.contains(info.id);
}
new AlertDialog.Builder(requireContext())
@@ -1146,7 +1149,8 @@ public class MapFragment extends Fragment {
labels.add(getString(R.string.track_spinner_hint));
for (TrackInfo t : savedTracks) {
String start = timeFormat.format(new Date((long) (t.started_at * 1000)));
labels.add("#" + t.id + " " + start + " (" + t.point_count + " pts)");
String mode = modemModeSuffix(modemModeFromTrack(t));
labels.add("#" + t.id + mode + " " + start + " (" + t.point_count + " pts)");
}
if (savedTracks.isEmpty()) {
labels.set(0, getString(R.string.track_none));
@@ -1214,6 +1218,78 @@ public class MapFragment extends Fragment {
}
fitBoundsOnce(boundsPoints, detail.points.size() == 1, true);
String mode = modemModeFromTrackDetail(detail);
if (mapStatus != null && mode != null) {
mapStatus.setText(getString(
R.string.track_loaded_mode,
detail.id,
LoraStatsFormatter.modemModeLabel(mode)
));
}
}
private static String modemModeSuffix(String mode) {
if (mode == null || mode.isBlank()) {
return "";
}
return " · " + LoraStatsFormatter.modemModeLabel(mode);
}
@SuppressWarnings("unchecked")
private static String modemModeFromTxParams(Map<String, Object> txParams) {
if (txParams == null) {
return null;
}
Object mode = txParams.get("modem_mode");
if (mode != null) {
return ModemMode.normalize(String.valueOf(mode));
}
if (txParams.get("bitrate_bps") != null) {
return ModemMode.GFSK;
}
if (txParams.get("spreading_factor") != null) {
return ModemMode.LORA;
}
return null;
}
@SuppressWarnings("unchecked")
private static String modemModeFromReference(ReferencePointInfo info) {
if (info == null || info.reference_context == null) {
return null;
}
Object txParams = info.reference_context.get("tx_params");
if (txParams instanceof Map) {
return modemModeFromTxParams((Map<String, Object>) txParams);
}
return null;
}
private static String modemModeFromTrack(TrackInfo track) {
if (track != null && track.modem_mode != null && !track.modem_mode.isBlank()) {
return ModemMode.normalize(track.modem_mode);
}
return null;
}
private static String modemModeFromTrackDetail(TrackDetail detail) {
if (detail == null || detail.points == null) {
return null;
}
for (int i = detail.points.size() - 1; i >= 0; i--) {
TrackDetail.TrackPoint p = detail.points.get(i);
RadioSnapshot snap = RadioSnapshot.fromMeta(p.meta, null, null);
if (snap.modemMode != null) {
return snap.modemMode;
}
if (snap.bitrateBps != null) {
return ModemMode.GFSK;
}
if (snap.sf != null) {
return ModemMode.LORA;
}
}
return null;
}
private static boolean isRxTrack(TrackDetail detail) {
+1
View File
@@ -82,6 +82,7 @@
<string name="reference_point_map_status">Реперов на карте: %1$d</string>
<string name="reference_point_repeat_hint">RX: %1$.6f, %2$.6f · дальность %3$s м</string>
<string name="reference_point_repeat_no_selection">Выберите реперную точку</string>
<string name="track_loaded_mode">Трек #%1$d · %2$s</string>
<string name="track_spinner_hint">Сохранённые треки</string>
<string name="track_none">— нет треков —</string>
<string name="stats_local_title">Это устройство</string>