4.3.5 patch #14

Merged
blizzardfinnegan merged 2 commits from devel into stable 2023-03-09 13:13:43 -05:00
5 changed files with 44 additions and 27 deletions

View file

@ -84,7 +84,7 @@ The first command stops all currently running `pigpio` daemon processes. The sec
4. Unplug *ONE* camera, and plug it back in to the same port. This will generate several lines of text in your terminal window.
5. Copy one of the lines, starting with `platform`, and, *crucially*, ending `.0`.
6. Paste this into your `udev` rule file, replacing the `fillerText` portion, but leaving the quotes. If you are using a terminal text editor, this will require you to either right click to paste, or press `Ctrl-Shift-v` rather than `Ctrl-v`, as `Ctrl-v` is used by the terminal for a separate purpose. The first line of the file distributed in this repo contains a commented-out example line, with the correct syntax.
7. Repeat steps 4-6 for all cameras in the fixture. If there are no new lines available, copy and paste the line into a new line to create a new rule, *ensuring to increment the number at the end of the line in the `SYMLINK` section*.
7. Repeat steps 4-6 for all cameras in the fixture. If there are no new lines available, copy and paste the line into a new line to create a new rule, *ensuring to add a unique name to the end of the line in the `SYMLINK` section*.
8. Save the file. If the file fails to save, you most likely have insufficient permissions to save the file, and will need to follow the terminal text editor instructions.
9. Once the file has been saved, reboot the Raspberry Pi to load the new `udev` rule.
9. Open a terminal, and check that the new symlinks were created successfully. This can be done by running the below command. If the symlinks have not been created successfully, restart from step 3 until all symlinks are created properly.
@ -112,9 +112,10 @@ To use this program, it *must* be run on a Raspberry Pi, with available GPIO.
sudo java -jar [name of JAR file, including extension]
```
4. What will happen next depends on your current version:
- Versions `4.0.0-rc1`,`4.0.0-rc2`, and `4.0.0` will create a terminal window. From there, use the numbers shown in the menu to control the fixture, and run tests as necessary.
- Versions `4.0.0-rc1`, `4.0.0-rc2`, `4.1.x`, and `4.3.x` will create a terminal window. From there, use the numbers shown in the menu to control the fixture, and run tests as necessary.
- An upcoming version will create a terminal window, which load things for a moment before also creating a GUI. This GUI can be used to control the fixture, and run tests as necessary.
- GUI development is currently limited to the `gui` branch.
- Version `4.2` contains a partially GUI design which is by now relatively out of date.
### Potential Errors
@ -127,7 +128,7 @@ sudo killall pigpiod
- If the file contains a `CAMERA INIT ERROR`, this means that the associated camera was not picked up properly. This can be due to several reasons. Below are some debugging steps to take. Note that this will cause cascading errors, if attempting to import a camera's config from a pre-existing config file, so config-related errors can be ignored.
1. Ensure that both cameras are plugged in properly.
2. Unplug, and then plug back in, the erroring camera.
3. Ensure that the `/dev/video-cam1` and `/dev/video-cam2` files are both created. If they are not, then you will need to update your `udev` rules, as in the Installation section.
3. Ensure that the `/dev/video-cam-left` and `/dev/video-cam-right` files are both created. If they are not, then you will need to update your `udev` rules, as in the Installation section.
4. Reboot the Raspberry Pi. (This can be done by opening the terminal, and typing `reboot`, then hitting enter.) Camera drivers occasionally fail to load on boot, and will unload after a long time with no use. Rebooting generally solves this issue (although it may take multiple reboots.)
## Building from source

View file

@ -448,7 +448,11 @@ public class Cli
}
//Exit loop
else break;
else
{
ConfigFacade.saveCurrentConfig();
break;
}
} while(true);
} while(true);
@ -613,7 +617,7 @@ public class Cli
LOCK.unlock();
//Wait for the DUT to display an image
try{ Thread.sleep(1500); } catch(Exception e){ ErrorLogging.logError(e); }
try{ Thread.sleep(2000); } catch(Exception e){ ErrorLogging.logError(e); }
//For all available cameras:
// take an image, process it, and save it to a file
@ -648,9 +652,12 @@ public class Cli
result >= 100 ||
result == Double.NEGATIVE_INFINITY)
{
ErrorLogging.logError("Invalid OCR reading! Resetting DUTs...");
MovementFacade.goUp();
ErrorLogging.logError("Waiting for 20 seconds to allow devices to fall asleep.");
try{ Thread.sleep(20000); }
catch(Exception e){ ErrorLogging.logError(e); }
ErrorLogging.logError("Waking devices...");
MovementFacade.pressButton();
fail = true;
break;

View file

@ -437,16 +437,20 @@ public class ConfigFacade
Map<ConfigProperties,Double> savedSection = new HashMap<>();
for(String cameraName : cameraNames)
{
if(!sectionName.equals(cameraName))
{ saveSingleDefault(cameraName); }
if(sectionName.equals(cameraName))
{
for(ConfigProperties configState : ConfigProperties.values())
{
Double configValue = CONFIG_STORE.getDouble(sectionName + "." + configState.getConfig());
//ErrorLogging.logError("DEBUG: Imported config value: " + Double.toString(configValue));
savedSection.put(configState,configValue);
}
}
}
for(ConfigProperties configState : ConfigProperties.values())
{
Double configValue = CONFIG_STORE.getDouble(sectionName + "." + configState.getConfig());
//ErrorLogging.logError("DEBUG: Imported config value: " + Double.toString(configValue));
savedSection.put(configState,configValue);
}
if(savedSection.size() == 0)
{ saveSingleDefault(sectionName); }
if(emptyMap) configMap.put(sectionName,savedSection);
else
{

View file

@ -172,28 +172,37 @@ public class DataSaving
int rowIndex = 0;
FormulaEvaluator formulaEvaluator = outputWorkbook.getCreationHelper().createFormulaEvaluator();
int lastColumnOfData = outputSheet.getRow(rowIndex).getLastCellNum();
int serialColumn = lastColumnOfData + 1;
int percentColumn = lastColumnOfData + 2;
int serialColumn = lastColumnOfData - 2;
int percentColumn = lastColumnOfData - 1;
//Get the last row, add another row below it, and name the first cell "Totals:"
int lastRowOfData = outputSheet.getLastRowNum();
//For each camera, create a unique total line
for(int column = 3; column <= (cameraCount*3); column+=3)
int column = 1;
for(int i = 0; i < cameraCount; i++)
{
String columnName = CellReference.convertNumToColString(column);
String serialColumnName = CellReference.convertNumToColString(column);
String dataColumnName = CellReference.convertNumToColString(column + 2);
ErrorLogging.logError("DEBUG: Serial Column name: " + serialColumnName);
HSSFRow row = outputSheet.getRow(++rowIndex);
if(row == null)
{
row = outputSheet.createRow(rowIndex);
}
ErrorLogging.logError("DEBUG: Row index: " + rowIndex);
ErrorLogging.logError("DEBUG: Column (int): " + serialColumn);
HSSFCell serialCell = row.createCell(serialColumn);
String formula = "$" + columnName + "$" + rowIndex;
String formula = "$" + serialColumnName + "$" + (rowIndex+1);
serialCell.setCellFormula(formula);
formulaEvaluator.evaluate(serialCell);
HSSFCell percentCell = row.createCell(percentColumn);
String verticalArray = String.format("$%s$2:$%s$%s",columnName,columnName,lastRowOfData);
String verticalArray = String.format("$%s$2:$%s$%s",dataColumnName,dataColumnName,(lastRowOfData+1));
ErrorLogging.logError("DEBUG: Vertical Array: " + verticalArray);
formula = String.format(
"(COUNT(%s)-(COUNTIF(%s,\"<%s\")+COUNTIF(%s,\">%s\",))/(COUNT(%s))",
"(COUNT(%s)-(COUNTIF(%s,\"<%s\")+COUNTIF(%s,\">%s\")))/(COUNT(%s))",
verticalArray,
verticalArray, (targetTemp - failRange),
verticalArray, (targetTemp + failRange),
@ -207,6 +216,7 @@ public class DataSaving
formulaEvaluator.evaluate(percentCell);
ErrorLogging.logError("DEBUG: Formula: " + formula);
column += 4;
}
//Once all totals have been created, write to the file
@ -228,7 +238,7 @@ public class DataSaving
boolean output = false;
int cellnum = 0;
int startingRow = outputSheet.getLastRowNum();
HSSFRow row = outputSheet.createRow(++startingRow);
HSSFRow row = (startingRow == 1) ? outputSheet.getRow(++startingRow) : outputSheet.createRow(++startingRow);
List<String> cameraNames = new ArrayList<>(cameraToFile.keySet());
//ErrorLogging.logError("DEBUG: image locations: " + imageLocations.toString());
//List<Object> objectArray = new LinkedList<>();
@ -287,10 +297,10 @@ public class DataSaving
//Create a blank cell as a spacer
row.createCell(cellnum++);
}
updateFormulas(cameraNames.size());
try (FileOutputStream outputStream = new FileOutputStream(outputFile))
{ outputWorkbook.write(outputStream); output = true; }
catch(Exception e) {ErrorLogging.logError(e);}
updateFormulas(cameraNames.size());
return output;
}
}

View file

@ -2,11 +2,6 @@
## High-priority fixes
### DataSaving
- [ ] Modify initialisation to create formula cells outside data lines
- Will need to evaluate functions on every line write
### OpenCVFacade
- [ ] completeProcess should have more robust file output checking