Skip to content

Dumping executed commands; build-script improvmenets #36

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin/
dist/
*.swp
16 changes: 11 additions & 5 deletions make.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/usr/bin/env bash

if [[ -z "$INSTALLDIR" ]]; then
INSTALLDIR="$HOME/Documents/Arduino"
if [[ -z "$TAG" ]]; then
TAG=1.6.12
fi
INSTALLDIR="$HOME/Arduino-$TAG/build/linux/work"
fi
if [[ -L "$INSTALLDIR" ]]; then
INSTALLDIR=$INSTALLDIR/
fi
echo "INSTALLDIR: $INSTALLDIR"

pde_path=`find ../../../ -name pde.jar`
core_path=`find ../../../ -name arduino-core.jar`
lib_path=`find ../../../ -name commons-codec-1.7.jar`
pde_path=`find ${INSTALLDIR} -name pde.jar`
core_path=`find ${INSTALLDIR} -name arduino-core.jar`
lib_path=`find ${INSTALLDIR} -name commons-codec-1.7.jar`
if [[ -z "$core_path" || -z "$pde_path" ]]; then
echo "Some java libraries have not been built yet (did you run ant build?)"
return 1
exit 1
fi
echo "pde_path: $pde_path"
echo "core_path: $core_path"
Expand Down
26 changes: 23 additions & 3 deletions src/ESP8266FS.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ private void createAndUpload(){
System.out.println("[SPIFFS] block : "+spiBlock);

try {
if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", (spiEnd - spiStart)+"", imagePath}) != 0){
String[] buildCmd = new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", (spiEnd - spiStart)+"", imagePath};
dumpCommand(buildCmd, "build.verbose");
if(listenOnProcess(buildCmd) != 0){
System.err.println();
editor.statusError("SPIFFS Create Failed!");
return;
Expand All @@ -298,6 +300,7 @@ private void createAndUpload(){
editor.statusNotice("SPIFFS Uploading Image...");
System.out.println("[SPIFFS] upload : "+imagePath);

String[] uploadCmd;
if(isNetwork){
String pythonCmd;
if(PreferencesData.get("runtime.os").contentEquals("windows"))
Expand All @@ -307,18 +310,35 @@ private void createAndUpload(){

System.out.println("[SPIFFS] IP : "+serialPort);
System.out.println();
sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath});
uploadCmd = new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath};
} else {
System.out.println("[SPIFFS] address: "+uploadAddress);
System.out.println("[SPIFFS] reset : "+resetMethod);
System.out.println("[SPIFFS] port : "+serialPort);
System.out.println("[SPIFFS] speed : "+uploadSpeed);
System.out.println();
sysExec(new String[]{esptool.getAbsolutePath(), "-cd", resetMethod, "-cb", uploadSpeed, "-cp", serialPort, "-ca", uploadAddress, "-cf", imagePath});
uploadCmd = new String[]{esptool.getAbsolutePath(), "-cd", resetMethod, "-cb", uploadSpeed, "-cp", serialPort, "-ca", uploadAddress, "-cf", imagePath};
}
dumpCommand(uploadCmd, "upload.verbose");
sysExec(uploadCmd);
}

public void run() {
createAndUpload();
}

private void dumpCommand(String[] fragments, String preference) {
if (!PreferencesData.getBoolean(preference)) {
return;
}

StringBuffer commandBuf = new StringBuffer(128);
for (int cnt = 0; cnt < fragments.length; cnt++) {
commandBuf.append(fragments[cnt]);
if (cnt < fragments.length - 1) {
commandBuf.append(" ");
}
}
System.out.println(commandBuf.toString());
}
}