App 2.11.0, server 2.3.0: live data straight to ABRP; settings regrouped
ABRP keeps getting live data while the car server is down: with an ABRP API key and user token set in the app (Live data tab, or abrp_api_key / abrp_token in the config file), the car sends the newest sample to ABRP itself at every upload. It tells the server the newest sample ABRP took (abrpSentUtc), and the server forwards only newer ones, so ABRP gets each sample once. Without credentials in the app the server forwards everything, as before. The credentials sit in encrypted storage, go in the request body, and neither they nor ABRP's answer are logged. Settings are grouped by what they are for: - Live data (was Upload): on/off, ABRP credentials, upload frequency. - Settings (replaces the Wi-Fi tab): full screen and voice key, usable capacity and manual SoH (were on Consumption), charging price (was on Charging), Wi-Fi. Charging and Live data get icons of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
+15
-1
@@ -117,6 +117,20 @@ func (a *API) ingest(h handler) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// notYetAtAbrp leaves out the samples the car already sent to ABRP itself.
|
||||
func notYetAtAbrp(samples []TelemetrySample, sentUTC int64) []TelemetrySample {
|
||||
if sentUTC == 0 {
|
||||
return samples
|
||||
}
|
||||
out := make([]TelemetrySample, 0, len(samples))
|
||||
for _, s := range samples {
|
||||
if s.UTC > sentUTC {
|
||||
out = append(out, s)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// maxDroppedListed caps the dropped values named in a telemetry response and log line.
|
||||
const maxDroppedListed = 20
|
||||
|
||||
@@ -136,7 +150,7 @@ func (a *API) telemetry(w http.ResponseWriter, r *http.Request, c caller, body [
|
||||
if err := a.Store.WriteTelemetry(r.Context(), batch.InstallationID, batch.Samples); err != nil {
|
||||
return err
|
||||
}
|
||||
a.Forwarder.Forward(batch.Samples)
|
||||
a.Forwarder.Forward(notYetAtAbrp(batch.Samples, batch.AbrpSentUTC))
|
||||
}
|
||||
dropped := batch.Dropped
|
||||
if len(dropped) > maxDroppedListed {
|
||||
|
||||
Reference in New Issue
Block a user