Reorganize project, remove some dead code

This commit is contained in:
Madeline 2023-03-20 20:03:18 -04:00
parent 6341b0464d
commit ba42ff1207
6 changed files with 20 additions and 72 deletions

View File

@ -22,7 +22,6 @@
E180B61F2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */; };
E180B6222993256E00425DB0 /* PrinterRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B6212993256E00425DB0 /* PrinterRequestManager.swift */; };
E1E8B07729949E2700BABE4B /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = E1E8B07629949E2700BABE4B /* Starscream */; };
E1E8B07929955ABE00BABE4B /* PrinterStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E8B07829955ABE00BABE4B /* PrinterStats.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -62,7 +61,6 @@
E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterObjectsQuery.swift; sourceTree = "<group>"; };
E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzMenuBarExtraView.swift; sourceTree = "<group>"; };
E180B6212993256E00425DB0 /* PrinterRequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterRequestManager.swift; sourceTree = "<group>"; };
E1E8B07829955ABE00BABE4B /* PrinterStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterStats.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -114,6 +112,8 @@
E180B5E72992CD9100425DB0 /* Soyuz */ = {
isa = PBXGroup;
children = (
E1A93C6529C92B3500BAE750 /* ViewModels */,
E1A93C6429C92AEE00BAE750 /* Views */,
E124B9D72993FE5500C0D2D2 /* Info.plist */,
E180B5E82992CD9100425DB0 /* SoyuzApp.swift */,
E180B5EC2992CD9200425DB0 /* Assets.xcassets */,
@ -121,11 +121,6 @@
E180B5F62992CD9200425DB0 /* Soyuz.entitlements */,
E180B5F32992CD9200425DB0 /* KlipperMon.xcdatamodeld */,
E180B5EE2992CD9200425DB0 /* Preview Content */,
E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */,
E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */,
E180B6212993256E00425DB0 /* PrinterRequestManager.swift */,
E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */,
E1E8B07829955ABE00BABE4B /* PrinterStats.swift */,
);
path = Soyuz;
sourceTree = "<group>";
@ -157,6 +152,24 @@
path = SoyuzUITests;
sourceTree = "<group>";
};
E1A93C6429C92AEE00BAE750 /* Views */ = {
isa = PBXGroup;
children = (
E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */,
E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */,
);
path = Views;
sourceTree = "<group>";
};
E1A93C6529C92B3500BAE750 /* ViewModels */ = {
isa = PBXGroup;
children = (
E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */,
E180B6212993256E00425DB0 /* PrinterRequestManager.swift */,
);
path = ViewModels;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -293,7 +306,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E1E8B07929955ABE00BABE4B /* PrinterStats.swift in Sources */,
E180B61D2992D53700425DB0 /* PrinterObjectsQuery.swift in Sources */,
E180B5F52992CD9200425DB0 /* KlipperMon.xcdatamodeld in Sources */,
E124B9D929941A4D00C0D2D2 /* PrinterConfigView.swift in Sources */,

View File

@ -1,44 +0,0 @@
//
// PrinterStats.swift
// KlipperMon
//
// Created by maddiefuzz on 2/9/23.
//
import Foundation
class PrinterStats: ObservableObject {
@Published var state: String
@Published var progress: Double
@Published var extruderTemperature: Double
@Published var bedTemperature: Double
init(response: jsonRpcResponse) {
state = response.result.status.print_stats?.state ?? ""
progress = response.result.status.virtual_sdcard?.progress ?? 0.0
extruderTemperature = response.result.status.extruder?.temperature ?? 0.0
bedTemperature = response.result.status.heater_bed?.temperature ?? 0.0
print(response)
}
func update(update: jsonRpcUpdate) {
// print(update)
if let newState = update.params.status?.print_stats?.state {
//state = update.params[0].print_stats?.state
state = newState
}
if let newProgress = update.params.status?.virtual_sdcard?.progress {
print("Update progress")
progress = newProgress
}
if let newExtruderTemp = update.params.status?.extruder?.temperature {
print("Update extruder temp \(newExtruderTemp)")
extruderTemperature = newExtruderTemp
}
if let newBedTemp = update.params.status?.heater_bed?.temperature {
print("Update heated bed \(newBedTemp)")
bedTemperature = newBedTemp
}
}
}

View File

@ -33,19 +33,6 @@ struct jsonRpcParams: Decodable {
self.timestamp = try container.decode(Double.self)
}
}
//
// public init(from decoder: Decoder) throws {
// let container = try decoder.container(keyedBy: CodingKeys.self)
//
// do {
// self = .statusData(try container.decode(StatusData.self, forKey: .statusData))
// } catch DecodingError.keyNotFound {
// print("Error")
// self = .double(try container.decode(Double.self))
// //self = .timestamp(try container.decode(Double.self, forKey: .timestamp))
// }
//
// }
// Root structs to decode for JSON-RPC response
struct jsonRpcResponse: Decodable {

View File

@ -18,14 +18,7 @@ protocol NetworkDiscoveryEngine {
func setStateUpdateHandler(_ handler: @escaping ((NWBrowser.State) -> Void))
}
//protocol NDEResult {
// var endpoint: NWEndpoint { get }
// var interface: [NWInterface] { get }
// var metadata: NWBrowser.Result.Metadata { get }
//}
extension NWBrowser: NetworkDiscoveryEngine {
//class NDEngine: NetworkDiscoveryEngine,
func startScan(queue: DispatchQueue) {
start(queue: queue)
}