Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with load file in part other_MIC2C_24XXX.cc #139

Open
kjellc opened this issue Mar 3, 2025 · 1 comment
Open

Problem with load file in part other_MIC2C_24XXX.cc #139

kjellc opened this issue Mar 3, 2025 · 1 comment

Comments

@kjellc
Copy link

kjellc commented Mar 3, 2025

There is a problem in part: other_MI2C_24CXXX.
When the "load" button is clicked, it will save the memory into the selected file instead.

I have found a fix for the problem. See the patch below.
Sorry, but I can not create a proper pull request since I already have a fork of picsimlab with other changes.

To Reproduce

  1. Click the "load" button of the 24CXXX part.
  2. Select a file to load and click "Open".
  3. A warning popup will open with a warning about overwriting the file (instead of loading it).

Patch

diff --git a/src/parts/other_MI2C_24CXXX.cc b/src/parts/other_MI2C_24CXXX.cc
index 9fd0cd21..3e140903 100644
--- a/src/parts/other_MI2C_24CXXX.cc
+++ b/src/parts/other_MI2C_24CXXX.cc
@@ -375,7 +375,7 @@ void cpart_MI2C_24CXXX::filedialog_EvOnClose(int retId) {
     if (retId) {
         int type;
         SpareParts.WindowCmd(PW_MAIN, "filedialog1", PWA_FILEDIALOGGETTYPE, NULL, &type);
-        if ((type == (PFD_OPEN | PFD_CHANGE_DIR))) {
+        if ((type == (PFD_SAVE | PFD_CHANGE_DIR))) {
             char buff[200];
             SpareParts.WindowCmd(PW_MAIN, "filedialog1", PWA_FILEDIALOGGETFNAME, NULL, buff);
             if (PICSimLab.SystemCmd(PSC_FILEEXISTS, buff)) {
@lcgamboa
Copy link
Owner

lcgamboa commented Mar 4, 2025

Hi @kjellc ,

Thanks for reporting the issue, I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants