Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/changelog.md
#	lib/ui/screens/overview/components/printer_card.dart
#	pubspec.yaml
  • Loading branch information
Clon1998 committed May 7, 2024
2 parents 9e4e11b + 1f930ba commit 3b02775
Show file tree
Hide file tree
Showing 60 changed files with 3,603 additions and 1,012 deletions.
27 changes: 26 additions & 1 deletion assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,32 @@
"hint": "Makros für die Gruppe {} auswählen"
},
"signIn": {
"subtitle": "Die Einrichtung eines Nutzerkontos ist zwar freiwillig, jedoch notwendig, um Käufe, die auf einem anderen Gerät oder einer anderen Plattform getätigt wurden, wiederherzustellen."
"subtitle": "Die Einrichtung eines Nutzerkontos ist zwar freiwillig, jedoch notwendig, um Käufe, die auf einem anderen Gerät oder einer anderen Plattform getätigt wurden, wiederherzustellen.",
"forgot_password": "Passwort vergessen?",
"forgot_password_success": "E-Mail zum Zurücksetzen des Passworts gesendet!",
"hint": {
"sign_in": "Haben Sie noch kein Konto?",
"sign_up": "Haben Sie bereits ein Konto?",
"reset_password": "Geben Sie Ihre E-Mail-Adresse ein, um einen Link zum Zurücksetzen des Passworts zu erhalten."
},
"action": {
"sign_in": "Anmelden",
"sign_up": "Registrieren",
"reset_password": "Passwort zurücksetzen"
},
"email": {
"label": "E-Mail",
"hint": "Ihre E-Mail-Adresse"
},
"password": {
"label": "Passwort",
"hint": "Ihr Passwort"
},
"confirm_password": {
"label": "Passwort bestätigen",
"hint": "Bestätigen Sie Ihr Passwort",
"error": "Passwörter stimmen nicht überein!"
}
},
"profile": {
"title": "Sie sind eingeloggt.",
Expand Down
27 changes: 26 additions & 1 deletion assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,32 @@
"hint": "Select macros for group {}"
},
"signIn": {
"subtitle": "Although creating an account is optional, it is necessary to do so in order to restore purchases made on another device or platform."
"subtitle": "Although creating an account is optional, it is necessary to do so in order to restore purchases made on another device or platform.",
"forgot_password": "Forgot Password?",
"forgot_password_success": "Password reset email sent!",
"hint": {
"sign_in": "Dont have an account yet?",
"sign_up": "Already have an account?",
"reset_password": "Provide your email address to receive a password reset link."
},
"action": {
"sign_in": "Sign In",
"sign_up": "Sign Up",
"reset_password": "Reset Password"
},
"email": {
"label": "Email",
"hint": "Your email address"
},
"password": {
"label": "Password",
"hint": "Your password"
},
"confirm_password": {
"label": "Confirm Password",
"hint": "Confirm your password",
"error": "Passwords do not match!"
}
},
"profile": {
"title": "You are signed in.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum ConfigFileObjectIdentifiers {
filament_switch_sensor(null),
filament_motion_sensor(null),
screws_tilt_adjust(null),
z_thermal_adjust(null),
;

/// IF it is possible to check a object with a == (null) or startsWith (true)
Expand Down
22 changes: 22 additions & 0 deletions common/lib/data/dto/machine/printer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:common/data/dto/machine/bed_mesh/bed_mesh.dart';
import 'package:common/data/dto/machine/filament_sensors/filament_sensor.dart';
import 'package:common/data/dto/machine/print_stats.dart';
import 'package:common/data/dto/machine/screws_tilt_adjust/screws_tilt_adjust.dart';
import 'package:common/data/dto/machine/z_thermal_adjust.dart';
import 'package:common/exceptions/mobileraker_exception.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

Expand Down Expand Up @@ -35,6 +36,23 @@ part 'printer.freezed.dart';
class PrinterBuilder {
PrinterBuilder();

factory PrinterBuilder.preview() {
var toolhead = const Toolhead();
var gCodeMove = const GCodeMove();
var motionReport = const MotionReport();
var print = const PrintStats();
var configFile = ConfigFile();
var virtualSdCard = const VirtualSdCard();

return PrinterBuilder()
..toolhead = toolhead
..gCodeMove = gCodeMove
..motionReport = motionReport
..print = print
..configFile = configFile
..virtualSdCard = virtualSdCard;
}

PrinterBuilder.fromPrinter(Printer printer)
: toolhead = printer.toolhead,
extruders = printer.extruders,
Expand All @@ -60,6 +78,7 @@ class PrinterBuilder {
leds = printer.leds,
genericHeaters = printer.genericHeaters,
filamentSensors = printer.filamentSensors,
zThermalAdjust = printer.zThermalAdjust,
currentFile = printer.currentFile;

Toolhead? toolhead;
Expand All @@ -79,6 +98,7 @@ class PrinterBuilder {
GCodeFile? currentFile;
FirmwareRetraction? firmwareRetraction;
BedMesh? bedMesh;
ZThermalAdjust? zThermalAdjust;
Map<String, NamedFan> fans = {};
Map<String, TemperatureSensor> temperatureSensors = {};
Map<String, OutputPin> outputPins = {};
Expand Down Expand Up @@ -135,6 +155,7 @@ class PrinterBuilder {
leds: Map.unmodifiable(leds),
genericHeaters: Map.unmodifiable(genericHeaters),
filamentSensors: Map.unmodifiable(filamentSensors),
zThermalAdjust: zThermalAdjust,
);
return printer;
}
Expand Down Expand Up @@ -162,6 +183,7 @@ class Printer with _$Printer {
FirmwareRetraction? firmwareRetraction,
BedMesh? bedMesh,
GCodeFile? currentFile,
ZThermalAdjust? zThermalAdjust,
@Default({}) Map<String, NamedFan> fans,
@Default({}) Map<String, TemperatureSensor> temperatureSensors,
@Default({}) Map<String, OutputPin> outputPins,
Expand Down
64 changes: 64 additions & 0 deletions common/lib/data/dto/machine/z_thermal_adjust.dart
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';
}
77 changes: 77 additions & 0 deletions common/lib/data/model/hive/dashboard_component.dart
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}';
}
}
44 changes: 44 additions & 0 deletions common/lib/data/model/hive/dashboard_component_type.dart
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;
}
Loading

0 comments on commit 3b02775

Please sign in to comment.