Daniel Poelzleithner 13 years ago
parent
commit
b31c8c1b37
  1. 2
      driver/timer.c
  2. 8
      ezchronos.c
  3. 8
      logic/altitude.c
  4. 12
      logic/menu.c
  5. 2
      logic/menu.h
  6. 6
      logic/rfsimpliciti.c
  7. 8
      logic/test.c

2
driver/timer.c

@ -334,6 +334,7 @@ __interrupt void TIMER0_A0_ISR(void)
if (is_temp_measurement()) request.flag.temperature_measurement = 1;
// Do a pressure measurement each second while menu item is active
#ifdef CONFIG_ALTITUDE
if (is_altitude_measurement())
{
// Countdown altitude measurement timeout while menu item is active
@ -353,6 +354,7 @@ __interrupt void TIMER0_A0_ISR(void)
// In case we missed the IRQ due to debouncing, get data now
if ((PS_INT_IN & PS_INT_PIN) == PS_INT_PIN) request.flag.altitude_measurement = 1;
}
#endif
// Count down timeout
if (is_acceleration_measurement())

8
ezchronos.c

@ -364,7 +364,9 @@ void init_global_variables(void)
reset_stopwatch();
// Reset altitude measurement
#ifdef CONFIG_ALTITUDE
reset_altitude_measurement();
#endif
// Reset acceleration measurement
reset_acceleration();
@ -548,7 +550,9 @@ void process_requests(void)
if (request.flag.temperature_measurement) temperature_measurement(FILTER_ON);
// Do pressure measurement
#ifdef CONFIG_ALTITUDE
if (request.flag.altitude_measurement) do_altitude_measurement(FILTER_ON);
#endif
// Do acceleration measurement
if (request.flag.acceleration_measurement) do_acceleration_measurement();
@ -720,7 +724,9 @@ void read_calibration_values(void)
simpliciti_ed_address[1] = sMyROMAddress.addr[1];
simpliciti_ed_address[2] = sMyROMAddress.addr[2];
simpliciti_ed_address[3] = sMyROMAddress.addr[3];
#ifdef CONFIG_ALTITUDE
sAlt.altitude_offset = 0;
#endif
}
else
{
@ -738,6 +744,7 @@ void read_calibration_values(void)
simpliciti_ed_address[2] = cal_data[8];
simpliciti_ed_address[3] = cal_data[9];
// S/W version byte set during calibration?
#ifdef CONFIG_ALTITUDE
if (cal_data[12] != 0xFF)
{
sAlt.altitude_offset = (s16)((cal_data[10] << 8) + cal_data[11]);;
@ -746,6 +753,7 @@ void read_calibration_values(void)
{
sAlt.altitude_offset = 0;
}
#endif
}
}

8
logic/altitude.c

@ -42,6 +42,8 @@
// system
#include "project.h"
#ifdef CONFIG_ALTITUDE
// driver
#include "altitude.h"
#include "display.h"
@ -219,7 +221,7 @@ void do_altitude_measurement(u8 filter)
// If sensor is not ready, skip data read
if ((PS_INT_IN & PS_INT_PIN) == 0) return;
// Get temperature (format is *10°K) from sensor
// Get temperature (format is *10?K) from sensor
sAlt.temperature = ps_get_temp();
// Get pressure (format is 1Pa) from sensor
@ -239,7 +241,7 @@ void do_altitude_measurement(u8 filter)
sAlt.pressure = pressure;
}
// Convert pressure (Pa) and temperature (°K) to altitude (m)
// Convert pressure (Pa) and temperature (?K) to altitude (m)
sAlt.altitude = conv_pa_to_meter(sAlt.pressure, sAlt.temperature);
}
@ -447,3 +449,5 @@ void display_altitude(u8 line, u8 update)
display_symbol(LCD_SYMB_ARROW_DOWN, SEG_OFF);
}
}
#endif // CONFIG_ALTITUDE

12
logic/menu.c

@ -156,8 +156,19 @@ const struct menu menu_L1_Temperature =
FUNCTION(mx_temperature), // sub menu function
FUNCTION(display_temperature), // display function
FUNCTION(update_temperature), // new display data
#ifdef CONFIG_ALTITUDE
&menu_L1_Altitude,
#else
#ifdef ELIMINATE_BLUEROBIN
&menu_L1_Acceleration,
#else
&menu_L1_Heartrate,
#endif
#endif
};
#ifdef CONFIG_ALTITUDE
// Line1 - Altitude
const struct menu menu_L1_Altitude =
{
@ -172,6 +183,7 @@ const struct menu menu_L1_Altitude =
&menu_L1_Heartrate,
#endif
};
#endif
//pfs
#ifndef ELIMINATE_BLUEROBIN

2
logic/menu.h

@ -72,7 +72,9 @@ struct menu
// Line1 navigation
extern const struct menu menu_L1_Time;
extern const struct menu menu_L1_Alarm;
#ifdef CONFIG_ALTITUDE
extern const struct menu menu_L1_Altitude;
#endif
extern const struct menu menu_L1_Temperature;
extern const struct menu menu_L1_Altitude;
extern const struct menu menu_L1_Heartrate;

6
logic/rfsimpliciti.c

@ -587,8 +587,10 @@ void start_simpliciti_sync(void)
as_stop();
// Get updated altitude
#ifdef CONFIG_ALTITUTDE
start_altitude_measurement();
stop_altitude_measurement();
#endif
// Get updated temperature
temperature_measurement(FILTER_OFF);
@ -681,8 +683,10 @@ void simpliciti_sync_decode_ap_cmd_callback(void)
sTemp.offset = offset;
sTemp.degrees = t1;
// Set altitude
#ifdef CONFIG_ALTITUDE
sAlt.altitude = (s16)((simpliciti_data[12]<<8) + simpliciti_data[13]);
update_pressure_table(sAlt.altitude, sAlt.pressure, sAlt.temperature);
#endif
break;
case SYNC_AP_CMD_GET_MEMORY_BLOCKS_MODE_1:
@ -747,8 +751,10 @@ void simpliciti_sync_get_data_callback(unsigned int index)
simpliciti_data[9] = sAlarm.minute;
simpliciti_data[10] = sTemp.degrees >> 8;
simpliciti_data[11] = sTemp.degrees & 0xFF;
#ifdef CONFIG_ALTITUDE
simpliciti_data[12] = sAlt.altitude >> 8;
simpliciti_data[13] = sAlt.altitude & 0xFF;
#endif
break;
case SYNC_ED_TYPE_MEMORY:

8
logic/test.c

@ -87,7 +87,7 @@ void test_mode(void)
Timer0_Stop();
// Disable LCD charge pump while in standby mode
// This reduces current consumption by ca. 5µA to ca. 10µA
// This reduces current consumption by ca. 5?A to ca. 10?A
LCDBVCTL = 0;
// Show welcome screen
@ -152,6 +152,7 @@ void test_mode(void)
while (BUTTON_STAR_IS_PRESSED && BUTTON_UP_IS_PRESSED);
break;
case 1: // Altitude measurement
#ifdef CONFIG_ALTITUDE
display_altitude(LINE1, DISPLAY_LINE_UPDATE_FULL);
for (i=0; i<2; i++)
{
@ -160,6 +161,7 @@ void test_mode(void)
display_altitude(LINE1, DISPLAY_LINE_UPDATE_PARTIAL);
}
stop_altitude_measurement();
#endif
break;
case 2: // Temperature measurement
display_temperature(LINE1, DISPLAY_LINE_UPDATE_FULL);
@ -239,7 +241,7 @@ void test_mode(void)
// Hold watchdog
WDTCTL = WDTPW + WDTHOLD;
// Sleep until button is pressed (ca. 4µA current consumption)
// Sleep until button is pressed (ca. 4?A current consumption)
_BIS_SR(LPM4_bits + GIE);
__no_operation();
@ -281,4 +283,4 @@ void display_all_on(void)
}
#endif // CONFIG_TEST
#endif // CONFIG_TEST

Loading…
Cancel
Save