Compare commits

..

No commits in common. "822845cc7abc45ca2187b0a42a91b8ca7761c49e" and "d964ebea372d212143b15aa72bab31cc56b14306" have entirely different histories.

4 changed files with 2 additions and 41 deletions

View File

@ -138,43 +138,9 @@ uint8_t route_command(int pos) {
case READ_CONFIG: case READ_CONFIG:
return READ_CONFIG; return READ_CONFIG;
case READ_VOLTAGE: case READ_VOLTAGE:
{ return READ_VOLTAGE;
// Create a union to store the data
union {
int16_t v;
uint8_t bytes[2];
} voltage;
// Figure out which voltage source to read
switch (context.src_voltage) {
case SRC_INTERNAL:
voltage.v = internal_voltage_read();
break;
case SRC_EXTRNAL:
voltage.v = external_voltage_read();
break;
case SRC_THERMISTOR:
voltage.v = thermistor_voltage_read();
break;
default:
return 0xFF;
break;
}
// Send the data
return voltage.bytes[pos];
}
case READ_TERMPERATURE: case READ_TERMPERATURE:
{ return READ_TERMPERATURE;
uint16_t v_therm = thermistor_voltage_read();
union {
int16_t temp;
uint8_t bytes[2];
} temperature;
temperature.temp = (int16_t) ( calculate_thermistor_temp(v_therm) * 1000 );
return temperature.bytes[pos];
}
break;
case READ_FAN_SPEED: case READ_FAN_SPEED:
if (context.fan == FAN1) { if (context.fan == FAN1) {
return fan1_history[0]; return fan1_history[0];

View File

@ -16,8 +16,6 @@ extern "C" {
#include <avr/io.h> #include <avr/io.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "voltage.h"
#include "themistor-temp.h"
// Enum of all valid command types // Enum of all valid command types
typedef enum { typedef enum {

View File

@ -29,8 +29,6 @@ volatile uint16_t fan2_history[512] = {2, 3, 4, 5};
int main() { int main() {
init_uart((uint16_t)9600); init_uart((uint16_t)9600);
ADC0_init();
init_led();
init_i2c(); init_i2c();
stdout = &USART_stream; stdout = &USART_stream;

View File

@ -29,7 +29,6 @@
<itemPath>voltage.c</itemPath> <itemPath>voltage.c</itemPath>
<itemPath>i2c.c</itemPath> <itemPath>i2c.c</itemPath>
<itemPath>command-handler.c</itemPath> <itemPath>command-handler.c</itemPath>
<itemPath>thermistor-temp.c</itemPath>
</logicalFolder> </logicalFolder>
</logicalFolder> </logicalFolder>
<projectmakefile>Makefile</projectmakefile> <projectmakefile>Makefile</projectmakefile>