Skip to content

Commit

Permalink
Fixing v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Spagett1 committed Apr 21, 2023
1 parent e12c1e2 commit ceb1fb0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/main.rs
Expand Up @@ -307,7 +307,6 @@ impl eframe::App for Flasher {
self.config.flash_notified_count += 1
} else {
Flasher::flash(self);
self.config.flash_notified_count = 0
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/submodules/connection_poller.rs
Expand Up @@ -15,7 +15,7 @@ impl Flasher {
if device_info.vendor_id() == 10473 && device_info.product_id() == 393 {
// pinecil v1 connected
v1 = true;
type_of_pinecil = Some("Pinecilv1".to_string())
type_of_pinecil = Some("Pinecil".to_string())
}
}

Expand Down
42 changes: 21 additions & 21 deletions src/submodules/flash.rs
Expand Up @@ -35,11 +35,11 @@ impl Flasher {
self.config.logs.push_str("PineFlash: File extracted successfully\n");


if cfg!(unix) && self.config.int_name == "Pinecilv1" {
if cfg!(unix) && self.config.int_name == "Pinecil" {
firmware_path = format!("{}/{}_{}.dfu", target.as_os_str().to_str().unwrap(), self.config.int_name, self.config.lang);
} else if cfg!(unix) && self.config.int_name == "Pinecilv2" {
firmware_path = format!("{}/{}_{}.bin", target.as_os_str().to_str().unwrap(), self.config.int_name, self.config.lang);
} else if cfg!(windows) && self.config.int_name == "Pinecilv1" {
} else if cfg!(windows) && self.config.int_name == "Pinecil" {
// Do windows functionality here.
firmware_path = format!("{}\\{}_{}.dfu", target.as_os_str().to_str().unwrap(), self.config.int_name, self.config.lang);
} else if cfg!(windows) && self.config.int_name == "Pinecilv2" {
Expand All @@ -53,7 +53,7 @@ impl Flasher {
}

self.config.logs.push_str(format!("PineFlash: Attempting to flash {} with the firmware {}\n", self.config.int_name, firmware_path).as_str());
if self.config.int_name == "Pinecilv1" {
if self.config.int_name == "Pinecil" {

#[cfg(target_os = "linux")]
let command = Command::new("pkexec")
Expand Down Expand Up @@ -142,25 +142,25 @@ impl Flasher {
}
self.config.logs.push_str(format!("Blisp: {}{}\n", output, output_err).as_str());

// Very ugly way of reseting the program
self.config.version = "Select".to_string();
self.config.fancy_names = vec![];
self.config.code_names = vec![];
self.config.versions_checked = false;
self.config.vers = vec![];
self.config.promise = None;
self.config.promise_2 = None;
self.config.promise_3 = None;
self.config.download_metadata = false;
self.config.download = false;
self.config.download_notify = true;
self.config.download_firm_notify = true;
self.config.picked_path = None;
self.config.ready_to_flash = false;
self.config.flash_notified_count = 0;
self.config.flash = false;


}

// Very ugly way of reseting the program
self.config.version = "Select".to_string();
self.config.fancy_names = vec![];
self.config.code_names = vec![];
self.config.versions_checked = false;
self.config.vers = vec![];
self.config.promise = None;
self.config.promise_2 = None;
self.config.promise_3 = None;
self.config.download_metadata = false;
self.config.download = false;
self.config.download_notify = true;
self.config.download_firm_notify = true;
self.config.picked_path = None;
self.config.ready_to_flash = false;
self.config.flash_notified_count = 0;
self.config.flash = false;
}
}
18 changes: 9 additions & 9 deletions src/submodules/main_panel.rs
Expand Up @@ -30,7 +30,7 @@ impl Flasher {
}
);
if self.config.iron == "Pinecil V1" {
self.config.int_name = "Pinecilv1".to_string();
self.config.int_name = "Pinecil".to_string();
} else if self.config.iron == "Pinecil V2" {
self.config.int_name = "Pinecilv2".to_string();
}
Expand All @@ -54,7 +54,7 @@ impl Flasher {
});
if ui.button(RichText::new("📁").size(17.)).clicked() {
if let Some(path) = rfd::FileDialog::new().pick_file() {
if !path.display().to_string().contains("dfu") && self.config.int_name == "Pinecilv1" ||
if !path.display().to_string().contains("dfu") && self.config.int_name == "Pinecil" ||
!path.display().to_string().contains("bin") && self.config.int_name == "Pinecilv2"
{
self.toasts.dismiss_all_toasts();
Expand Down Expand Up @@ -91,15 +91,15 @@ impl Flasher {

});

if self.config.picked_path.is_some() &&
self.config.iron_connected.as_ref() == Some(&self.config.int_name) ||
self.config.iron_connected.as_ref() == Some(&"Both".to_string()) ||
if self.config.picked_path.is_some() || //&&
// self.config.iron_connected.as_ref() == Some(&self.config.int_name) ||
// self.config.iron_connected.as_ref() == Some(&"Both".to_string()) ||
self.config.version != *"Custom" &&
self.config.version != *"Select" &&
!self.config.download &&
self.config.iron_connected.as_ref() == Some(&self.config.int_name) ||
self.config.iron_connected.as_ref() == Some(&"Both".to_string()){

!self.config.download //&&
// self.config.iron_connected.as_ref() == Some(&self.config.int_name) ||
// self.config.iron_connected.as_ref() == Some(&"Both".to_string())
{
self.config.ready_to_flash = true

} else {
Expand Down

0 comments on commit ceb1fb0

Please sign in to comment.