Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Last running version
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rancor/users/u9/drinksvr/svn/newDrink/tini@203 e1c6a677-3c05-0410-8139-d630aaec0cf4
  • Loading branch information
adinardi committed Sep 17, 2008
1 parent 46efa39 commit f6d6166
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
19 changes: 17 additions & 2 deletions ConfigMgr.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ConfigMgr {
/**
* Contains the 1-Wire IDs of the Temp Monitors
*/
private String[] temps = new String[1];
private String[] temps = null; //new String[1];

/**
* Contains the timings for motor on time for drops
Expand Down Expand Up @@ -88,6 +88,17 @@ public boolean runLights() {
public String[] getTemps() {
return temps;
}

/**
* Return true if tempterature sensors exist in the system
*/
public boolean runTemps() {
if (temps == null) {
return false;
} else {
return true;
}
}

public int getDropTime() {
return dropTime;
Expand Down Expand Up @@ -140,9 +151,13 @@ private void readConfig() {
}else if( temp.charAt(0) == 't' ) { //temp id
System.out.println( "Got Temp Row" );
if( temp.charAt(1) == 't' ) { //total #
if (Integer.parseInt(temp.substring(2)) != 0) {
this.temps = new String[Integer.parseInt( temp.substring(2) ) ];
System.out.println( "Got Temps Total: " + this.temps.length );
continue;
} else {
System.out.println("Temp Disabled");
}
continue;
}

num = Integer.parseInt(temp.substring(1,3));
Expand Down
2 changes: 1 addition & 1 deletion IncomingLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void listen() {
this.setPriority( Thread.MAX_PRIORITY );
int stat = OneWireCommands.getInstance().drop( Integer.parseInt(data) );
this.setPriority( Thread.NORM_PRIORITY );

System.out.println("About to send drop ack... " + stat);
if( stat == 200 ) {
CommLink.getInstance().getOutgoingLink().sendDropACK();
}else{
Expand Down
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
TINICODE = ../tini1.02g/
TINICONVLINE = java -classpath ../tini1.02g/bin/tini.jar BuildDependency -d ../tini1.02g/bin/tini.db -add OneWireContainer05 -add OneWireContainer28 -add OneWireMonitor -x ../tini1.02g/bin/owapi_dep.txt -p ../tini1.02g/bin/owapi_dependencies_TINI.jar
PATH=/usr/bin:/opt/sun-jdk-1.5.0.06/bin/

#TINICODE = ../tini1.02g/
#TINICONVLINE = java -classpath ../tini1.02g/bin/tini.jar BuildDependency -d ../tini1.02g/bin/tini.db -add OneWireContainer05 -add OneWireContainer28 -add OneWireMonitor -x ../tini1.02g/bin/owapi_dep.txt -p ../tini1.02g/bin/owapi_dependencies_TINI.jar

TINICODE = ../tini1.02h/
TINICONVLINE = java -classpath ../tini1.02h/bin/tini.jar BuildDependency -d ../tini1.02h/bin/tini.db -add OneWireContainer05 -add OneWireContainer28 -add OneWireMonitor -x ../tini1.02h/bin/owapi_dep.txt -p ../tini1.02h/bin/owapi_dependencies_TINI.jar

#TINICODE = ../tini1.17/
#TINICONVLINE = java -classpath ../tini1.17/bin/tini.jar BuildDependency -d ../tini1.17/bin/tini.db -add OneWireContainer05 -add OneWireContainer28 -add OneWireMonitor -x ../tini1.17/bin/owapi_dep.txt -p ../tini1.17/bin/owapi_dependencies_TINI.jar


default: commlinktest

compile:
javac -target 1.1 -source 1.3 -bootclasspath ../tini1.02g/bin/tiniclasses.jar -classpath ../tini1.02g/bin/owapi_dependencies_TINI.jar *.java
javac -target 1.1 -source 1.3 -bootclasspath $(TINICODE)bin/tiniclasses.jar -classpath $(TINICODE)bin/owapi_dependencies_TINI.jar *.java

lightshow: compile
java -classpath tini1.02g/bin/tini.jar BuildDependency -f OneWireCommands.class -f Tester.class -f OneWireLightShow.class -d tini1.02g/bin/tini.db -o Tester.tini -add OneWireContainer05 -x tini1.02g/bin/owapi_dep.txt -p tini1.02g/bin/owapi_dependencies_TINI.jar
$(TINICONVLINE) -f CollectGarbage.class -f OneWireCommands.class -f OneWireLights.class -f SlotMonitorListener.class -f CommLink.class -f IncomingLink.class -f OutgoingLink.class -f ConfigMgr.class -f Tester.class -f OneWireLightShow.class -m Tester -o Tester.tini

switcher: compile
$(TINICONVLINE) -f SwitchChanger.class -m SwitchChanger -o SwitchChanger.tini

commlinktest: compile
$(TINICONVLINE) -f CollectGarbage.class -f OneWireCommands.class -f OneWireLights.class -f SlotMonitorListener.class -f CommLink.class -f IncomingLink.class -f OutgoingLink.class -f ConfigMgr.class -f Starter.class -f TempWorker.class -m Starter -o Starter.tini
Expand Down
2 changes: 2 additions & 0 deletions OneWireCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ public int drop ( int slot ) {
}catch ( Exception e ) {}

//check is empty for status?
System.out.println("isEmpty Check Starting...");
isEmpty( slot );
System.out.println("isEmpty Check Done");

//end use of the bus
adapter.endExclusive();
Expand Down
4 changes: 3 additions & 1 deletion OutgoingLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ public void sendLogin() {

public void sendDropACK() {
try {
System.out.println("Sending Drop ACK");
out = new DataOutputStream(socket.getOutputStream());

System.out.println("Writing 4");
out.writeBytes( "4\n" );
out.flush();

}catch( Exception e ) {
e.printStackTrace();
CommLink.getInstance().Reconnect();
}
System.out.println("ack'ed");
}

public void sendTemp( double temp ) {
Expand Down
8 changes: 5 additions & 3 deletions Starter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ public static void main( String[] args ) {
//Start up the OneWireCommands which will make the initial empty sensor load.
OneWireCommands.getInstance();

//start up our minutely temperature sensor/sender
TempWorker temp = new TempWorker();
temp.start();
if (ConfigMgr.getInstance().runTemps()) {
//start up our minutely temperature sensor/sender
TempWorker temp = new TempWorker();
temp.start();
}

CollectGarbage cg = new CollectGarbage();
Thread cgt = new Thread( cg );
Expand Down
Binary file modified Starter.tini
Binary file not shown.
4 changes: 3 additions & 1 deletion TempWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public void run() {
temp = owc.readTemp();

//send it
CommLink.getInstance().getOutgoingLink().sendTemp( temp );
if( temp != 0 ) {
CommLink.getInstance().getOutgoingLink().sendTemp( temp );
}
//System.out.println( "Sending" );

//sleep
Expand Down
11 changes: 7 additions & 4 deletions Tester.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*

public class Tester {
public static void main(String[] args) {
OneWireLightShow owc = new OneWireLightShow();
OneWireLightShow owc = OneWireLightShow.getInstance();
/*
if( args.length > 0 ) {
owc.drop( Integer.parseInt(args[0]) );
}else{
Expand All @@ -10,6 +11,8 @@ public static void main(String[] args) {
owc.bouncingDot( false, 10 );
owc.worm( false, 10 );
}
}
}*/
Thread t = new Thread(owc);
t.start();
}
}*/
}

0 comments on commit f6d6166

Please sign in to comment.