Mercurial > ~darius > hgwebdir.cgi > tempctrl
changeset 73:56165caf744b
Missed some USB related crud + copyright updates.
author | darius@Inchoate |
---|---|
date | Wed, 21 Jan 2009 18:01:17 +1030 |
parents | 13f8e6eb5c01 |
children | e3d1f56ba0c8 |
files | main.c tempctrl.c |
diffstat | 2 files changed, 3 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Wed Jan 21 16:37:32 2009 +1030 +++ b/main.c Wed Jan 21 18:01:17 2009 +1030 @@ -1,7 +1,7 @@ /* - * Test various AVR bits and pieces + * Monitor fermenter temperature and control it by switching cooler & heater. * - * Copyright (c) 2008 + * Copyright (c) 2009 * Daniel O'Connor <darius@dons.net.au>. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,9 +38,6 @@ #include "cons.h" #include "1wire.h" -#ifdef WITHUSB -#include "usb.h" -#endif #include "tempctrl.h" #include "ds1307.h" @@ -74,22 +71,12 @@ MCUCSR |= _BV(JTD); #endif -#ifdef WITHUSB - /* USB data bus (7:0) */ - DDRA = 0x00; - PORTA = 0x00; - - /* USB control (4:0) */ - DDRB = 0x0d; - PORTB = 0x00; -#else DDRA = 0xff; PORTA = 0x00; DDRB = 0x00; PORTB = 0x00; -#endif /* GPIO (0:7) */ DDRC = 0xff; PORTC = 0x00; @@ -98,7 +85,6 @@ DDRD = 0xf7; PORTD = 0xf7; -#ifndef WITHUSB /* Beep * * Fpwm = Fclk / (N * 510) @@ -110,7 +96,6 @@ * Phase correct PWM, non-inverted output, divide by 8 */ TCCR0 = _BV(WGM00) | _BV(WGM11) | _BV(COM00) | _BV(COM01) | _BV(CS01); OCR0 = 128; -#endif /* Set up the one wire stuff */ OWInit(); @@ -153,12 +138,6 @@ */ wdt_enable(WDTO_2S); -#ifdef WITHUSB - printf_P(PSTR("Calling usb_init\r\n")); - usb_init(); - printf_P(PSTR("done\r\n")); - _delay_us(1000); -#endif printf_P(PSTR("> ")); cmd.state = 0; @@ -174,11 +153,6 @@ /* Allow new characters to be processed */ cmd.state = 0; } - -#ifdef WITHUSB - if (!(PDICTL & _BV(PDIINT))) - usb_intr(); -#endif } } @@ -211,9 +185,6 @@ "zz Reset MCU\r\n" "gc Get time of day\r\n" "sc time Set time of day (time is YYYY/MM/DD HH:MM:SS)\r\n" -#ifdef WITHUSB - "us Generate USB data\r\n" -#endif "tc ... Temperature control related (tc help for more)\r\n")); return; @@ -552,10 +523,6 @@ } } else if (!strncasecmp_P((char *)cmd.buf, PSTR("tc"), 2)) { tempctrl_cmd((char *)cmd.buf); -#ifdef WITHUSB - } else if (!strncasecmp_P((char *)cmd.buf, PSTR("us"), 2)) { - usb_gendata(); -#endif } else if (!strncasecmp_P((char *)cmd.buf, PSTR("gc"), 2)) { ds1307_printtime(PSTR(""), PSTR("\r\n")); } else if (!strncasecmp_P((char *)cmd.buf, PSTR("sc"), 2)) {
--- a/tempctrl.c Wed Jan 21 16:37:32 2009 +1030 +++ b/tempctrl.c Wed Jan 21 18:01:17 2009 +1030 @@ -1,7 +1,7 @@ /* * Temperature control logic * - * Copyright (c) 2008 + * Copyright (c) 2009 * Daniel O'Connor <darius@dons.net.au>. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,10 +81,8 @@ int16_t check_interval; int16_t stale_factor; -#ifndef WITHUSB /* Beep if stale */ int8_t dobeep; -#endif } __attribute__((packed)) settings_t; /* Current settings in RAM */ @@ -115,17 +113,13 @@ .idlebits = 0x00, .check_interval = 10, .stale_factor = 3, -#ifndef WITHUSB .dobeep = 0 -#endif }; /* Local variable declarations */ volatile static time_t now; -#ifndef WITHUSB volatile static uint8_t beeping = 0; volatile static uint8_t lasttoggle = 0; -#endif /* Local function prototypes */ static void tempctrl_load_or_init_settings(void); @@ -176,7 +170,6 @@ now.sec++; } -#ifndef WITHUSB if (beeping) { lasttoggle++; // 63 * 8ms = ~0.5s @@ -188,7 +181,6 @@ DDRB &= ~_BV(PB3); lasttoggle = 0; } -#endif } /* @@ -296,13 +288,11 @@ if (stale) nextstate = 'i'; -#ifndef WITHUSB /* Handle beeping */ if (settings.dobeep && stale) beeping = 1; else beeping = 0; -#endif /* Handle state forcing */ if (settings.mode != TC_MODE_AUTO) @@ -482,9 +472,7 @@ " h Always heat\r\n" " i Always idle\r\n" " n Like idle but don't log anything\r\n" -#ifndef WITHUSB "tc beep [01] Enable/disable beeping when data is stale\r\n" -#endif "tc X Y Set X to Y where X is one of\r\n" " targ Target temperature\r\n" " hys Hysteresis range\r\n" @@ -524,9 +512,7 @@ "Min heat overshoot - %d, Min cool overshoot - %d\r\n" "Min cool on time - %d, Min cool off time - %d\r\n" "Min heat on time - %d, Min heat off time - %d\r\n" -#ifndef WITHUSB "Beep on stale - %S\r\n" -#endif ), settings.fermenter_ROM[0], settings.fermenter_ROM[1], settings.fermenter_ROM[2], settings.fermenter_ROM[3], settings.fermenter_ROM[4], settings.fermenter_ROM[5], settings.fermenter_ROM[6], settings.fermenter_ROM[7], @@ -538,9 +524,7 @@ settings.minheatovershoot, settings.mincoolovershoot, settings.mincoolontime, settings.minheatontime, settings.minheatontime, settings.minheatofftime, -#ifndef WITHUSB settings.dobeep ? PSTR("yes") : PSTR("no") -#endif ); return; } @@ -560,7 +544,6 @@ } return; } -#ifndef WITHUSB if (!strcasecmp_P(cmd, PSTR("beep"))) { if (buf[8] == '1' || buf[8] == 'y') settings.dobeep = 1; @@ -570,7 +553,6 @@ printf_P(PSTR("Expected a y/1 or n/0\r\n")); return; } -#endif if (!strcasecmp_P(cmd, PSTR("ferm")) || !strcasecmp_P(cmd, PSTR("frg")) || !strcasecmp_P(cmd, PSTR("amb"))) {