internal data sources (clock, static text), connection indicator, rendering fixes
DataSourceConfig refactored to enum: External/Clock/StaticText. Clock generates formatted time via chrono, static text emits configured string. ESP32: connection status indicator (green/red dot bottom-right), per-widget clear before redraw, RenderEvent enum for local + server messages. Polling uses DataUpdate instead of ScreenUpdate to avoid wiping widget state. Empty mappings passthrough raw source data for internal sources.
This commit is contained in:
@@ -36,7 +36,7 @@ fn weather_source() -> DataSource {
|
||||
name: "openweather".into(),
|
||||
source_type: DataSourceType::Weather,
|
||||
poll_interval: Duration::from_secs(300),
|
||||
config: DataSourceConfig {
|
||||
config: DataSourceConfig::External {
|
||||
url: Some("https://api.openweather.org".into()),
|
||||
headers: vec![],
|
||||
api_key: Some("test-key".into()),
|
||||
@@ -125,8 +125,13 @@ async fn save_and_retrieve_data_source() {
|
||||
assert_eq!(ds.name, "openweather");
|
||||
assert_eq!(ds.source_type, DataSourceType::Weather);
|
||||
assert_eq!(ds.poll_interval, Duration::from_secs(300));
|
||||
assert_eq!(ds.config.url, Some("https://api.openweather.org".into()));
|
||||
assert_eq!(ds.config.api_key, Some("test-key".into()));
|
||||
match &ds.config {
|
||||
DataSourceConfig::External { url, api_key, .. } => {
|
||||
assert_eq!(*url, Some("https://api.openweather.org".into()));
|
||||
assert_eq!(*api_key, Some("test-key".into()));
|
||||
}
|
||||
_ => panic!("expected External config"),
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user