Skip to content

Commit

Permalink
Compare error fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShamWerks committed Apr 2, 2017
1 parent 43f1918 commit 68a3c53
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 64 deletions.
3 changes: 0 additions & 3 deletions src/main/java/com/shamwerks/camwerks/CamWerks.java
Expand Up @@ -59,7 +59,6 @@ public void setFrame(CwFrame frame) {

public static void main(String[] args) throws IOException {
instance.config = new Config();
System.out.println(instance.config.getNbSteps());

EventQueue.invokeLater(new Runnable() {
public void run() {
Expand All @@ -77,8 +76,6 @@ public void run() {


public void runMeasureSequence(){
System.out.println("Looping through Cylinders cams");

boolean connected = arduino.initialize();

if(connected) {
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/shamwerks/camwerks/config/Config.java
Expand Up @@ -16,17 +16,13 @@ public class Config {
private String comPorts[];

public Config(){
System.out.println("Working Directory = " + System.getProperty("user.dir"));
//loading the config.properties file
Properties props = new Properties();
try {
//System.out.println("stream=" + this.getClass().getResourceAsStream(CONFIG_FILE));
//props.load( this.getClass().getResourceAsStream(CONFIG_FILE ) );
props.load( new FileInputStream( CONFIG_FILE ) );
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("config="+props);
language = props.getProperty("language");
nbSteps = Integer.parseInt(props.getProperty("nbSteps"));
nbStepsIncrement = Integer.parseInt(props.getProperty("nbStepsIncrement"));
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/shamwerks/camwerks/config/Lang.java
Expand Up @@ -19,29 +19,14 @@ public static String getText(LangEntry key){
public Lang(){
Locale currentLocale = Locale.FRENCH;


/*
ResourceBundle labels = ResourceBundle.getBundle("config/Language", currentLocale);
Enumeration<String> bundleKeys = labels.getKeys();
while (bundleKeys.hasMoreElements()) {
String key = (String)bundleKeys.nextElement();
String value = labels.getString(key);
//System.out.println("key = " + key + ", " + "value = " + value);
langMap.put(key, value);
}
*/

Properties props = new Properties();
try {
props.load( new FileInputStream( "config/Language_" + currentLocale + ".properties") );
} catch (IOException e) {
e.printStackTrace();
}
for (Object key : props.keySet() ) {
//String key = (String)bundleKeys.nextElement();
String value = props.getProperty(key.toString());
//System.out.println("key = " + key + ", " + "value = " + value);
langMap.put(key.toString(), value);
}

Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/shamwerks/camwerks/gui/CwCamMeasure.java
Expand Up @@ -31,16 +31,7 @@ public class CwCamMeasure extends JDialog implements ActionListener{ //, Observe
private double normalizeOffset = 0.0;

public CwCamMeasure() {

Camshaft camshaft = CamWerks.getInstance().getCamshaft();
/*
System.out.println("-------------------------");
System.out.println("Camshaft size=" + camshaft.getNbCams());
for(int i=0 ; i<camshaft.getNbCams() ; i++){
System.out.println("cam = " + camshaft.getCam(i).getDescription());
}
System.out.println("-------------------------");
*/

setResizable(false);
setModalityType(ModalityType.APPLICATION_MODAL);
Expand Down Expand Up @@ -96,7 +87,6 @@ public void processNextCam(){
Camshaft camshaft = CamWerks.getInstance().getCamshaft();
//disable button

// Cam cam = camshaft.getCam( measureSequence.get(measureSequenceIdx) );
Cam cam = camshaft.getCam( measureSequenceIdx );

btnStartButton.setEnabled(false);
Expand All @@ -115,8 +105,6 @@ public void processNextCam(){
cam.setValue(i, measure - normalizeOffset);
CamWerks.getInstance().getFrame().updateCamshaftDisplay();//.getPanelLineChart().updateDatasetFromCamshaft();

//System.out.println("step " + i + " -> " + measure);

lblStep.setText( "Step : " + (i+1) + " / " + camshaft.getNbSteps() );
lblCycle.setText( "Cycle : " + (c+1) + " / " + camshaft.getNbCycles() );
lblValue.setText( "Value : " + measure );
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/shamwerks/camwerks/gui/CwMenu.java
Expand Up @@ -169,9 +169,7 @@ private void actionNewCamshaft(){
try {
CwNewCamshaft dialog = new CwNewCamshaft();
dialog.setLocationRelativeTo( CamWerks.getInstance().getFrame() );
System.out.println("aaa");
dialog.setVisible(true); //Blocking!!
System.out.println("bbb");
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -203,6 +201,7 @@ private void actionOpenFileCompareTo(){
}

private void actionCloseFile(){
//TODO
System.out.println("TO DO!");
}

Expand All @@ -212,7 +211,6 @@ private void actionSaveCsv(){
fd.setVisible(true);
String filename = fd.getFile();
if (filename != null){
System.out.println("ssss" + filename + " --- " + fd.getDirectory());
CamWerks.getInstance().getCamshaft().saveAsCSV(fd.getDirectory() + filename);
}
}
Expand Down
Expand Up @@ -65,7 +65,6 @@ public void drawSeries (Graphics2D g2, Rectangle2D dataArea,
}
}
}
System.out.println( "seriesIndex=" + seriesIndex + " / paint=" + lookupSeriesPaint (seriesIndex) );
g2.setPaint (lookupSeriesPaint (seriesIndex));
g2.setStroke (lookupSeriesStroke (seriesIndex));
g2.draw (polyline);
Expand Down Expand Up @@ -144,7 +143,6 @@ private void updateDatasetFromCamshaft(Camshaft camshaft, boolean isCompare){
}
seriesID++;


//sliding window average algorithm :
double[] filtered = new double[camshaft.getNbSteps()];
int slidingWindowSize = 9; //must be an odd/uneven number : 1 3 5 7 9... 1 means no average, just raw data
Expand All @@ -157,21 +155,6 @@ private void updateDatasetFromCamshaft(Camshaft camshaft, boolean isCompare){
filtered[j] = total / slidingWindowSize;
}

/*
**** MatLab Algorith : enveloppe of a family of lines ****
base = 12;
N = size(raw, 1);
dth = .6;
th = dth * raw(:, 1)' / 180 * pi;
l = raw(:, 2)' + base;
dl = diff(l) ./ diff(th);
dl = [ dl ( l(1)-l(end) )/( th(1)+360-th(end) ) ];
cth = cos(th);
sth = sin(th);
x = l.*cth - dl.*sth;
y = l.*sth + dl.*cth;
*/

double dth = (360.0d / camshaft.getNbSteps());
XYSeries xys = new XYSeries(legend + ((isCompare)?"_Compare":""));
for (int j = 0; j < camshaft.getNbSteps() ; j++) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/shamwerks/camwerks/gui/CwPanelDetails.java
Expand Up @@ -47,7 +47,6 @@ public CwPanelDetails() {
}
fileContent = parseHtmlTags(fileContent);

//System.out.println(fileContent);
detailsEditPane.setText( fileContent );
add(detailsEditPane);

Expand All @@ -66,7 +65,6 @@ public void updateCamshaftDetails(){

fileContent = parseHtmlTags(fileContent);

//System.out.println("fileContent = " + fileContent);
detailsEditPane.setText(fileContent);
}

Expand Down
Expand Up @@ -130,8 +130,6 @@ public void updateDatasetFromCamshaft_OriginalOK(){
public void updateDatasetFromCamshaft(){
series.removeAllSeries();
updateDatasetFromCamshaft( CamWerks.getInstance().getCamshaft() , false );
updateDatasetFromCamshaft( CamWerks.getInstance().getCamshaftCompareTo() , true);

String chartTitle = CamWerks.getInstance().getCamshaft().getName();

if(CamWerks.getInstance().getCamshaftCompareTo() != null){
Expand All @@ -145,7 +143,6 @@ public void updateDatasetFromCamshaft(){


private void updateDatasetFromCamshaft(Camshaft camshaft, boolean isCompare){
System.out.println(camshaft);
if(camshaft == null) return;

XYPlot xyPlot = (XYPlot) chart.getPlot();
Expand Down Expand Up @@ -173,16 +170,16 @@ private void updateDatasetFromCamshaft(Camshaft camshaft, boolean isCompare){
renderer.setSeriesPaint(seriesID, Color.green);
}
}
seriesID++;

XYSeries localXYSeries = new XYSeries(legend + ((isCompare)?"_Compare"+seriesID:""));
XYSeries localXYSeries = new XYSeries(legend + ((isCompare)?"_Compare":""));

for (int j = 0; j < camshaft.getNbSteps() ; j++) {
double x = j * (360.0d / camshaft.getNbSteps()) * 2;
localXYSeries.add(x, cam.getValue(j));
}
series.addSeries(localXYSeries);

seriesID++;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/shamwerks/camwerks/pojo/Camshaft.java
Expand Up @@ -84,8 +84,6 @@ public static Camshaft parseCamFile(String camFilePath){
camshaft.addCam( cam );
}
}

System.out.println("================\n" + camshaft + "\n================");
return camshaft;
}

Expand Down Expand Up @@ -113,7 +111,6 @@ public void saveAsCSV(String filePath){
}
content.append( "\r\n");
}
System.out.println(content);
//TODO !!!!
}

Expand Down

0 comments on commit 68a3c53

Please sign in to comment.