-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
189 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mobileraker/data/dto/config/fan/config_fan.dart'; | ||
|
||
part 'config_controller_fan.freezed.dart'; | ||
|
||
part 'config_controller_fan.g.dart'; | ||
|
||
@freezed | ||
class ConfigControllerFan extends ConfigFan with _$ConfigControllerFan { | ||
const ConfigControllerFan._(); | ||
|
||
const factory ConfigControllerFan({ | ||
required String name, | ||
required String pin, | ||
@JsonKey(name: 'max_power') @Default(1) double maxPower, | ||
@JsonKey(name: 'shutdown_speed') @Default(0) double shutdownSpeed, | ||
@JsonKey(name: 'cycle_time') @Default(0.010) double cycleTime, | ||
@JsonKey(name: 'hardware_pwm') @Default(false) bool hardwarePwm, | ||
@JsonKey(name: 'kick_start_time') @Default(0.100) double kickStartTime, | ||
@JsonKey(name: 'off_below') @Default(0) double offBelow, | ||
@JsonKey(name: 'tachometer_pin') String? tachometerPin, | ||
@JsonKey(name: 'tachometer_ppr') @Default(2) int? tachometerPpr, | ||
@JsonKey(name: 'tachometer_poll_interval') | ||
@Default(0.0015) | ||
double? tachometerPollInterval, | ||
@JsonKey(name: 'enable_pin') String? enablePin, | ||
@JsonKey(name: 'fan_speed') @Default(1) double fanSpeed, | ||
@JsonKey(name: 'idle_timeout') @Default(30) int idleTimeout, | ||
@JsonKey(name: 'idle_speed') @Default(1.0) double idleSpeed, | ||
required String heater, | ||
required String stepper, | ||
|
||
}) = _ConfigControllerFan; | ||
|
||
factory ConfigControllerFan.fromJson(String name, Map<String, dynamic> json) => | ||
_$ConfigControllerFanFromJson({...json, 'name': name}); | ||
} |
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,16 @@ | ||
abstract class ConfigFan { | ||
const ConfigFan(); | ||
|
||
abstract final String name; | ||
abstract final String pin; | ||
abstract final double maxPower; | ||
abstract final double shutdownSpeed; | ||
abstract final double cycleTime; | ||
abstract final bool hardwarePwm; | ||
abstract final double kickStartTime; | ||
abstract final double offBelow; | ||
abstract final String? tachometerPin; | ||
abstract final int? tachometerPpr; | ||
abstract final double? tachometerPollInterval; | ||
abstract final String? enablePin; | ||
} |
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,31 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mobileraker/data/dto/config/fan/config_fan.dart'; | ||
|
||
part 'config_generic_fan.freezed.dart'; | ||
|
||
part 'config_generic_fan.g.dart'; | ||
|
||
@freezed | ||
class ConfigGenericFan extends ConfigFan with _$ConfigGenericFan { | ||
const ConfigGenericFan._(); | ||
|
||
const factory ConfigGenericFan({ | ||
required String name, | ||
required String pin, | ||
@JsonKey(name: 'max_power') @Default(1) double maxPower, | ||
@JsonKey(name: 'shutdown_speed') @Default(0) double shutdownSpeed, | ||
@JsonKey(name: 'cycle_time') @Default(0.010) double cycleTime, | ||
@JsonKey(name: 'hardware_pwm') @Default(false) bool hardwarePwm, | ||
@JsonKey(name: 'kick_start_time') @Default(0.100) double kickStartTime, | ||
@JsonKey(name: 'off_below') @Default(0) double offBelow, | ||
@JsonKey(name: 'tachometer_pin') String? tachometerPin, | ||
@JsonKey(name: 'tachometer_ppr') @Default(2) int? tachometerPpr, | ||
@JsonKey(name: 'tachometer_poll_interval') | ||
@Default(0.0015) | ||
double? tachometerPollInterval, | ||
@JsonKey(name: 'enable_pin') String? enablePin, | ||
}) = _ConfigGenericFan; | ||
|
||
factory ConfigGenericFan.fromJson(String name, Map<String, dynamic> json) => | ||
_$ConfigGenericFanFromJson({...json, 'name': name}); | ||
} |
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,34 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mobileraker/data/dto/config/fan/config_fan.dart'; | ||
|
||
part 'config_heater_fan.freezed.dart'; | ||
|
||
part 'config_heater_fan.g.dart'; | ||
|
||
@freezed | ||
class ConfigHeaterFan extends ConfigFan with _$ConfigHeaterFan { | ||
const ConfigHeaterFan._(); | ||
|
||
const factory ConfigHeaterFan({ | ||
required String name, | ||
required String pin, | ||
@JsonKey(name: 'max_power') @Default(1) double maxPower, | ||
@JsonKey(name: 'shutdown_speed') @Default(0) double shutdownSpeed, | ||
@JsonKey(name: 'cycle_time') @Default(0.010) double cycleTime, | ||
@JsonKey(name: 'hardware_pwm') @Default(false) bool hardwarePwm, | ||
@JsonKey(name: 'kick_start_time') @Default(0.100) double kickStartTime, | ||
@JsonKey(name: 'off_below') @Default(0) double offBelow, | ||
@JsonKey(name: 'tachometer_pin') String? tachometerPin, | ||
@JsonKey(name: 'tachometer_ppr') @Default(2) int? tachometerPpr, | ||
@JsonKey(name: 'tachometer_poll_interval') | ||
@Default(0.0015) | ||
double? tachometerPollInterval, | ||
@JsonKey(name: 'enable_pin') String? enablePin, | ||
@JsonKey(name: 'heater_temp') @Default(50) double heaterTemp, | ||
@JsonKey(name: 'fan_speed') @Default(1) double fanSpeed, | ||
required String heater, | ||
}) = _ConfigHeaterFan; | ||
|
||
factory ConfigHeaterFan.fromJson(String name, Map<String, dynamic> json) => | ||
_$ConfigHeaterFanFromJson({...json, 'name': name}); | ||
} |
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,34 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mobileraker/data/dto/config/fan/config_fan.dart'; | ||
|
||
part 'config_print_cooling_fan.freezed.dart'; | ||
|
||
part 'config_print_cooling_fan.g.dart'; | ||
|
||
@freezed | ||
class ConfigPrintCoolingFan extends ConfigFan with _$ConfigPrintCoolingFan { | ||
const ConfigPrintCoolingFan._(); | ||
|
||
const factory ConfigPrintCoolingFan({ | ||
required String pin, | ||
@JsonKey(name: 'max_power') @Default(1) double maxPower, | ||
@JsonKey(name: 'shutdown_speed') @Default(0) double shutdownSpeed, | ||
@JsonKey(name: 'cycle_time') @Default(0.010) double cycleTime, | ||
@JsonKey(name: 'hardware_pwm') @Default(false) bool hardwarePwm, | ||
@JsonKey(name: 'kick_start_time') @Default(0.100) double kickStartTime, | ||
@JsonKey(name: 'off_below') @Default(0) double offBelow, | ||
@JsonKey(name: 'tachometer_pin') String? tachometerPin, | ||
@JsonKey(name: 'tachometer_ppr') @Default(2) int? tachometerPpr, | ||
@JsonKey(name: 'tachometer_poll_interval') | ||
@Default(0.0015) | ||
double? tachometerPollInterval, | ||
@JsonKey(name: 'enable_pin') String? enablePin, | ||
}) = _ConfigPrintCoolingFan; | ||
|
||
factory ConfigPrintCoolingFan.fromJson( | ||
String name, Map<String, dynamic> json) => | ||
_$ConfigPrintCoolingFanFromJson({...json, 'name': name}); | ||
|
||
@override | ||
String get name => 'Print cooling fan'; | ||
} |
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,37 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mobileraker/data/dto/config/fan/config_fan.dart'; | ||
|
||
part 'config_temperature_fan.freezed.dart'; | ||
|
||
part 'config_temperature_fan.g.dart'; | ||
|
||
@freezed | ||
class ConfigTemperatureFan extends ConfigFan with _$ConfigTemperatureFan { | ||
const ConfigTemperatureFan._(); | ||
|
||
const factory ConfigTemperatureFan({ | ||
required String name, | ||
required String pin, | ||
@JsonKey(name: 'max_power') @Default(1) double maxPower, | ||
@JsonKey(name: 'shutdown_speed') @Default(0) double shutdownSpeed, | ||
@JsonKey(name: 'cycle_time') @Default(0.010) double cycleTime, | ||
@JsonKey(name: 'hardware_pwm') @Default(false) bool hardwarePwm, | ||
@JsonKey(name: 'kick_start_time') @Default(0.100) double kickStartTime, | ||
@JsonKey(name: 'off_below') @Default(0) double offBelow, | ||
@JsonKey(name: 'tachometer_pin') String? tachometerPin, | ||
@JsonKey(name: 'tachometer_ppr') @Default(2) int? tachometerPpr, | ||
@JsonKey(name: 'tachometer_poll_interval') | ||
@Default(0.0015) | ||
double? tachometerPollInterval, | ||
@JsonKey(name: 'enable_pin') String? enablePin, | ||
@JsonKey(name: 'min_temp') @Default(0) double minTemp, | ||
@JsonKey(name: 'max_temp') @Default(50) double maxTemp, | ||
@JsonKey(name: 'target_temp') @Default(40) double targetTemp, | ||
@JsonKey(name: 'max_speed') @Default(1) double maxSpeed, | ||
@JsonKey(name: 'min_speed') @Default(0.3) double minSpeed, | ||
}) = _ConfigTemperatureFan; | ||
|
||
factory ConfigTemperatureFan.fromJson( | ||
String name, Map<String, dynamic> json) => | ||
_$ConfigTemperatureFanFromJson({...json, 'name': name}); | ||
} |