-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # docs/changelog.md # lib/ui/screens/overview/components/printer_card.dart # pubspec.yaml
- Loading branch information
Showing
60 changed files
with
3,603 additions
and
1,012 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2023-2024. Patrick Schmidt. | ||
* All rights reserved. | ||
*/ | ||
|
||
import 'package:common/data/dto/machine/sensor_mixin.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
import '../../../util/json_util.dart'; | ||
|
||
part 'z_thermal_adjust.freezed.dart'; | ||
part 'z_thermal_adjust.g.dart'; | ||
|
||
// z_thermal_adjust | ||
// { | ||
// 'temperature': self.smoothed_temp, | ||
// 'measured_min_temp': round(self.measured_min, 2), | ||
// 'measured_max_temp': round(self.measured_max, 2), | ||
// 'current_z_adjust': self.z_adjust_mm, | ||
// 'z_adjust_ref_temperature': self.ref_temperature, | ||
// 'enabled': self.adjust_enable | ||
// } | ||
|
||
@freezed | ||
class ZThermalAdjust with _$ZThermalAdjust, SensorMixin { | ||
const ZThermalAdjust._(); | ||
|
||
@JsonSerializable(fieldRename: FieldRename.snake) | ||
const factory ZThermalAdjust({ | ||
@Default(false) bool enabled, | ||
@Default(0) double temperature, | ||
@Default(0) double measuredMinTemp, | ||
@Default(0) double measuredMaxTemp, | ||
@Default(0) double currentZAdjust, | ||
@Default(0) double zAdjustRefTemperature, | ||
@JsonKey(name: 'temperatures') List<double>? temperatureHistory, | ||
required DateTime lastHistory, | ||
}) = _ZThermalAdjust; | ||
|
||
factory ZThermalAdjust.fromJson(Map<String, dynamic> json) => _$ZThermalAdjustFromJson(json); | ||
|
||
factory ZThermalAdjust.partialUpdate(ZThermalAdjust? current, Map<String, dynamic> partialJson) { | ||
if (current == null) return ZThermalAdjust.fromJson(partialJson); | ||
|
||
var mergedJson = {...current.toJson(), ...partialJson}; | ||
|
||
// Ill just put the tempCache here because I am lazy.. kinda sucks but who cares | ||
// Update temp cache for graphs! | ||
DateTime now = DateTime.now(); | ||
|
||
if (now.difference(current.lastHistory).inSeconds >= 1) { | ||
mergedJson = { | ||
...mergedJson, | ||
'temperatures': updateHistoryListInJson(mergedJson, 'temperatures', 'temperature'), | ||
'last_history': now.toIso8601String() | ||
}; | ||
} | ||
|
||
return ZThermalAdjust.fromJson(mergedJson); | ||
} | ||
|
||
@override | ||
String get name => 'z_thermal_adjust'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2023-2024. Patrick Schmidt. | ||
* All rights reserved. | ||
*/ | ||
|
||
import 'package:common/data/model/hive/dashboard_component_type.dart'; | ||
import 'package:hive_flutter/hive_flutter.dart'; | ||
import 'package:uuid/uuid.dart'; | ||
|
||
part 'dashboard_component.g.dart'; | ||
|
||
@HiveType(typeId: 10) | ||
class DashboardComponent extends HiveObject { | ||
DashboardComponent({ | ||
required this.type, | ||
this.showWhilePrinting = true, | ||
this.showBeforePrinterReady = false, | ||
}); | ||
|
||
DashboardComponent._({ | ||
required this.uuid, | ||
required this.type, | ||
this.showWhilePrinting = true, | ||
this.showBeforePrinterReady = false, | ||
}); | ||
|
||
@HiveField(0) | ||
String uuid = const Uuid().v4(); | ||
|
||
@HiveField(1) | ||
DashboardComponentType type; | ||
|
||
@HiveField(2) | ||
bool showWhilePrinting; | ||
|
||
@HiveField(3) | ||
bool showBeforePrinterReady; | ||
|
||
DashboardComponent copyWith({ | ||
DashboardComponentType? type, | ||
bool? showWhilePrinting, | ||
bool? showBeforePrinterReady, | ||
}) { | ||
return DashboardComponent._( | ||
uuid: uuid, | ||
type: type ?? this.type, | ||
showWhilePrinting: showWhilePrinting ?? this.showWhilePrinting, | ||
showBeforePrinterReady: showBeforePrinterReady ?? this.showBeforePrinterReady, | ||
); | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is DashboardComponent && | ||
runtimeType == other.runtimeType && | ||
(identical(uuid, other.uuid) || uuid == other.uuid) && | ||
(identical(type, other.type) || type == other.type) && | ||
(identical(showWhilePrinting, other.showWhilePrinting) || showWhilePrinting == other.showWhilePrinting) && | ||
(identical(showBeforePrinterReady, other.showBeforePrinterReady) || | ||
showBeforePrinterReady == other.showBeforePrinterReady); | ||
|
||
// const DeepCollectionEquality().equals(components, other.components); | ||
|
||
@override | ||
int get hashCode => Object.hash( | ||
uuid, | ||
type, | ||
showWhilePrinting, | ||
showBeforePrinterReady, | ||
); | ||
|
||
@override | ||
String toString() { | ||
return 'DashboardComponent{uuid: $uuid, type: $type, showWhilePrinting: $showWhilePrinting}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2023-2024. Patrick Schmidt. | ||
* All rights reserved. | ||
*/ | ||
|
||
import 'package:hive_flutter/hive_flutter.dart'; | ||
|
||
part 'dashboard_component_type.g.dart'; | ||
|
||
@HiveType(typeId: 11) | ||
enum DashboardComponentType { | ||
@HiveField(0) | ||
machineStatus, | ||
@HiveField(1) | ||
temperatureSensorPreset, | ||
@HiveField(2) | ||
webcam, | ||
@HiveField(3) | ||
controlXYZ, | ||
@HiveField(4) | ||
zOffset, | ||
@HiveField(5) | ||
spoolman, | ||
@HiveField(6) | ||
macroGroup, | ||
@HiveField(7) | ||
controlExtruder, | ||
@HiveField(8) | ||
fans, | ||
@HiveField(9) | ||
pins, | ||
@HiveField(10) | ||
powerApi, | ||
@HiveField(11) | ||
groupedSliders, | ||
@HiveField(12) | ||
multipliers, | ||
@HiveField(13) | ||
limits, | ||
@HiveField(14) | ||
firmwareRetraction, | ||
@HiveField(15) | ||
bedMesh; | ||
} |
Oops, something went wrong.