Skip to content

Commit

Permalink
Dumping executed commands; build-script improvmenets
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoisel authored and Rainer Poisel committed Jul 17, 2017
1 parent 779a4d7 commit 37b1b11
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
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());
}
}

0 comments on commit 37b1b11

Please sign in to comment.