mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-26 05:26:37 +10:00
fix: address PR #296 code review feedback
- Clamp ML predictions between physics floor (raw airtime) and ceiling (worst-case formula) so model can never produce unsafe timeouts - Replace hourOfDay feature with secondsSinceLastRx for network activity - Remove unused _ContactStats.stdDev and dead model persistence code - Debounce observation writes (2s) instead of writing on every delivery - Skip recording observations when pathLength is null to avoid corrupting training data - Add comment explaining global (not per-contact) RX time tracking - Remove notifyListeners from retrain to avoid unnecessary widget rebuilds - Run dart format
This commit is contained in:
@@ -8,7 +8,6 @@ class StorageService {
|
||||
static const String _pendingMessagesKey = 'pending_messages';
|
||||
static const String _repeaterPasswordsKey = 'repeater_passwords';
|
||||
static const String _deliveryObservationsKey = 'delivery_observations';
|
||||
static const String _timeoutModelKey = 'timeout_ml_model';
|
||||
|
||||
Future<void> savePathHistory(
|
||||
String contactPubKeyHex,
|
||||
@@ -143,10 +142,7 @@ class StorageService {
|
||||
try {
|
||||
final list = jsonDecode(jsonStr) as List;
|
||||
return list
|
||||
.map(
|
||||
(e) =>
|
||||
DeliveryObservation.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.map((e) => DeliveryObservation.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
} catch (e) {
|
||||
return [];
|
||||
@@ -157,19 +153,4 @@ class StorageService {
|
||||
final prefs = PrefsManager.instance;
|
||||
await prefs.remove(_deliveryObservationsKey);
|
||||
}
|
||||
|
||||
Future<void> saveTimeoutModel(String modelJson) async {
|
||||
final prefs = PrefsManager.instance;
|
||||
await prefs.setString(_timeoutModelKey, modelJson);
|
||||
}
|
||||
|
||||
Future<String?> loadTimeoutModel() async {
|
||||
final prefs = PrefsManager.instance;
|
||||
return prefs.getString(_timeoutModelKey);
|
||||
}
|
||||
|
||||
Future<void> clearTimeoutModel() async {
|
||||
final prefs = PrefsManager.instance;
|
||||
await prefs.remove(_timeoutModelKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user