done with cleaning up

This commit is contained in:
Stefan Kögl 2012-11-18 15:40:32 +01:00
parent 5be31d4c86
commit ca1862796b
4 changed files with 108 additions and 1 deletions

2
.gitignore vendored
View File

@ -3,4 +3,4 @@
build build
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
*egg-info/

12
firmware/log.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "ProfileLog.h"
ProfileLog::ProfileLog() {
// timestamps of event beginnings/ends
Ts_time_start = 0;
Ts_time_end = 0;
Tl_time_start = 0;
Tl_time_end = 0;
Tp_time_start = 0;
Tp_time_end = 0;
}

14
firmware/log.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef _LOG_H
#define _LOG_H
class ProfileLog {
// timestamps of event beginnings/ends
int Ts_time_start;
int Ts_time_end;
int Tl_time_start;
int Tl_time_end;
int Tp_time_start;
int Tp_time_end;
};
#endif

81
reflowctl/serialmon.py Executable file
View File

@ -0,0 +1,81 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import serial, struct, time
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=2)
buf = ""
alles = []
#def parse():
#buffer = list()
#while 1:
#try:
#i = ser.read(1)
#if ord(i) == 255:
#except Exception, e:
#print e
#else:
def recv_config():
ser.write(chr(255))
ser.flush()
read(30)
ser.flushInput()
data = struct.unpack("hhhhhhhhhhhhhhh", buf)
print
print "Profile:"
print "ts_min:", data[0]
print "ts_max:", data[1]
print "tl:", data[2]
print "tp:", data[3]
print "time_max:", data[4]
print "ramp_up_min:", data[5]
print "ramp_up_max:", data[6]
print "ramp_down_min:", data[7]
print "ramp_down_max:", data[8]
print "ts_duration_min:", data[9]
print "ts_duration_max:", data[10]
print "tl_duration_min:", data[11]
print "tl_duration_max:", data[12]
print "tp_duration_min:", data[13]
print "tp_duration_max:", data[14]
print
def recv_state():
ser.write(chr(254))
ser.flush()
read(11)
data = struct.unpack("hhhhhb", buf)
print "time: %ds, temperature: %d°C, last temperature: %d°C, state: %d, error condition: %d, heating: %d" % data
def send_config():
ser.write(chr(253))
ser.write(buf)
ser.flushInput()
def read(l):
global buf
global alles
buf = ""
while len(buf) < l:
try:
buf += ser.read(l)
alles.append(buf)
except Exception, e:
print e
ser.flushInput()
time.sleep(2)
recv_config()
while 1:
recv_state()
time.sleep(1)