Closed IArchi closed 1 year ago
There are some errors with the OS detection:
OSType
should be removed.
Mac
should be MacOS
.
OSType os = getOperatingSystem();
switch(os) {
case Windows:
process = Runtime.getRuntime().exec("cmd /c start compile_and_flash_20 " + backup_name);
break;
case MacOS:
case Linux:
process = Runtime.getRuntime().exec("compile_and_flash_20.sh " + backup_name);
break;
case Other:
default:
JOptionPane.showMessageDialog(null, " Unknown OS.\n Please run:\ncd src/controller && make && make clear_eeprom && make flash\nto compile and flash your TSDZ2.");
break;
}
It would be good to update jar file too. Here is jar and netbeans project files. Java_Configurator_Source.zip Maybe you could add NetBeans project files to git? I found it in some older TSDZ2 fork. I haven't checked which files are sufficient to open the project.
Regarding EEPROM clearing. Ideally, we shouldn't clear the EEPROM after programming if the parameter structure doesn't change or is appended. But the structure did change like 8 months ago https://github.com/emmebrusa/TSDZ2-Smart-EBike-1/commit/ff8a3133f99b667893a43977978a0ad564f9cf55 .
I don't know. I guess it's not that serious and the clearing is ok by default. But I modify it locally not to clear.
The best would be to read the software version and store a table for the script to decide between which releases eeprom needs to be cleared.
I've fixed my code. I've pushed the wrong version earlier. Now, on Linux and MacOS devices, it opens a terminal like on Windows.
Regarding EEPROM, if I'm not wrong, you are already doing the samething with that Windows command:
STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data_empty.ihx -verbose -no_loop -verif -no_warn_protect
Especially this parameter: -FileData=data_empty.ihx
On Linux and MacOS, the clear_eeprom command uses the same file:
stm8flash -c stlinkv2 -p stm8s105?6 -w data_empty.ihx
Regarding EEPROM, if I'm not wrong, you are already doing the samething with that Windows command:
STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data_empty.ihx -verbose -no_loop -verif -no_warn_protect
Especially this parameter:-FileData=data_empty.ihx
This line was added by @emmebrusa when he was merging, due to some USB issue. Initially, in my PR changes, I was not clearing the EEPROM.
I think it's going to be up to him whether to clear it or not.
- Script is automatically called from the GUI basing on the detected OS.
I tried the proposed changes in Ubuntu 22.04, clicking Compile&Flash in configurator, it creates ini and config.h files, but compile_and_flash_20.sh doesn't start (Allow executing file as program is enabled). I state that I know little about Linux, what could be the problem?