trigger image progress

This commit is contained in:
rusefi 2018-02-28 23:31:58 -05:00
parent 923a5e97a2
commit 5db803a2bd
5 changed files with 2442 additions and 6 deletions

View File

@ -384,21 +384,21 @@ void printAllTriggers() {
TriggerShape *s = &engine->triggerCentral.triggerShape;
s->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\r\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition);
fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition);
fprintf(fp, "# duty %.2f %.2f\r\n", s->expectedDutyCycle[0], s->expectedDutyCycle[1]);
fprintf(fp, "# duty %.2f %.2f\n", s->expectedDutyCycle[0], s->expectedDutyCycle[1]);
for (int i = 0; i < s->getLength(); i++) {
int triggerDefinitionCoordinate = (s->getTriggerShapeSynchPointIndex() + i) % s->getSize();
fprintf(fp, "event %d %d %.2f\r\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
fprintf(fp, "event %d %d %.2f\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
}
}
fclose(fp);
printf("All triggers exported to %s\r\n", TRIGGERS_FILE_NAME);
printf("All triggers exported to %s\n", TRIGGERS_FILE_NAME);
}
#endif

View File

@ -65,8 +65,10 @@ public class TriggerImage {
}
private static void generateImages(String workingFolder, TriggerPanel trigger) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(workingFolder + File.separator + INPUT_FILE_NAME));
String fileName = workingFolder + File.separator + INPUT_FILE_NAME;
BufferedReader br = new BufferedReader(new FileReader(fileName));
System.out.println("Reading " + fileName);
String line;
while ((line = br.readLine()) != null) {
if (line.trim().startsWith("#")) {
@ -85,6 +87,7 @@ public class TriggerImage {
String idStr = tokens[1];
String eventCountStr = tokens[2];
String triggerName = tokens[3];
System.out.println("Processing " + line + " " + idStr);
triggerPanel.tdcPosition = Double.parseDouble(tokens[4]);
int eventCount = Integer.parseInt(eventCountStr);
int id = Integer.parseInt(idStr);
@ -152,6 +155,8 @@ public class TriggerImage {
if (line.trim().startsWith("#"))
continue;
tokens = line.split(" ");
if (tokens.length < 4)
throw new IllegalStateException("Unexpected [" + line + "]");
String signalStr = tokens[2];
int signal = Integer.parseInt(signalStr);
String angleStr = tokens[3];

View File

@ -44,6 +44,7 @@ public class UiUtils {
public static void saveImage(String fileName, Component component) {
BufferedImage img = getScreenShot(component);
System.out.println("Saving " + fileName);
try {
ImageIO.write(img, "png", new File(fileName));
} catch (IOException e) {

View File

@ -1,3 +1,2 @@
.dep*
build/
triggers.txt

2431
unit_tests/triggers.txt Normal file

File diff suppressed because it is too large Load Diff