romel_emperado
Advanced Member level 2
- Joined
- Jul 23, 2009
- Messages
- 606
- Helped
- 45
- Reputation
- 132
- Reaction score
- 65
- Trophy points
- 1,318
- Location
- philippines
- Activity points
- 6,061
guys i need help ... How do i call the function mx_cal(); ?? what is that u8 line parameter? i dont have idea how do i call that from the function i made below which is burned_cal();
// system
#include "project.h"
// driver
#include "display.h"
#include "ports.h"
// logic
#include "romel.h"
#include "clock.h"
#include "date.h"
#include "user.h"
// Global Variable section
struct br mel;
s8 weight2, time;
s8 met2;
float kcal;
// Prototypes section
void display_romel(u8 line, u8 update)
{
if (update == DISPLAY_LINE_UPDATE_FULL)
{
display_chars(LCD_SEG_L2_5_0, (u8 *)" CAL0", SEG_ON);
}
}
void mx_cal(u8 line)
{
u8 select;
s32 weight;
s32 met;
// Clear display
clear_display_all();
// Convert global variables to local variables
//kcalories = mel.calories/1000;
met = mel.met_value/1000;
if (sys.flag.use_metric_units) weight = mel.user_weight;
else weight = ((s32)mel.user_weight * 2205) / 1000; // Convert kg to lb
// Init value index
select = 0;
// Loop values until all are set or user breaks set
while(1)
{
// Idle timeout : exit without saving
if (sys.flag.idle_timeout) break;
// Button STAR (short): save, then exit
if (button.flag.star)
{
// Store local variables in global structure
//mel.calories = kcalories*1000;
//mel.user_sex = sex;
mel.met_value = met*1000;
if (sys.flag.use_metric_units) mel.user_weight = weight;
else mel.user_weight = (weight * 1000) / 2205;
// Set display update flag
display.flag.line1_full_update = 1;
break;
}
switch (select)
{
case 0: // Set user weight
clear_line(LINE2);
if (sys.flag.use_metric_units)
{
display_chars(LCD_SEG_L2_1_0, (u8 *)"KG", SEG_ON);
set_value(&weight, 3, 2, USER_WEIGHT_MIN_KG, USER_WEIGHT_MAX_KG, SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_4_2, display_value1);
}
else
{
display_chars(LCD_SEG_L2_1_0, (u8 *)"LB", SEG_ON);
set_value(&weight, 3, 2, USER_WEIGHT_MIN_LB, USER_WEIGHT_MAX_LB, SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_4_2, display_value1);
weight2 = weight;
}
select = 1;
break;
case 1: //Set MET
display_chars(LCD_SEG_L2_1_0, (u8 *)"ME", SEG_ON);
set_value(&met, 3, 2, USER_WEIGHT_MIN, USER_METS_MAX, SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_4_2, display_value1);
met2 = met;
select = 0;
break;
}
}
// Clear button flags
button.all_flags = 0;
}
//calorie expernditure forMULa
void burned_cal(void)
{
if(sTime.second == 60)
{
time++;
}
kcal = ((met2 * 3.5 * (weight2/2.2)) / 200) * time;
}
Last edited: