set max dynamically
This commit is contained in:
parent
e7d3c7697e
commit
323666f128
24
src/main.c
24
src/main.c
@ -18,16 +18,16 @@ const int digit_bitmaps[10][5][3] = {
|
||||
{{1,1,1},{1,0,1},{1,1,1},{0,0,1},{1,1,1}} // 9
|
||||
};
|
||||
|
||||
void get_fake_data(int *speed, int *power, int *bat, float *tq, int *rpm, float *eff, float *bat_temp, float *var_temp, float *mot_temp) {
|
||||
*speed = rand() % 201;
|
||||
*power = rand() % 1251;
|
||||
*bat = rand() % 101;
|
||||
*tq = 1.8f + ((float)rand() / (float)RAND_MAX) * (3.5f - 1.8f);
|
||||
*rpm = rand() % 6000;
|
||||
*eff = (float)rand() / (float)RAND_MAX * 300.0f;
|
||||
*bat_temp = (float)rand() / (float)RAND_MAX * 150.0f;
|
||||
*var_temp = (float)rand() / (float)RAND_MAX * 150.0f;
|
||||
*mot_temp = (float)rand() / (float)RAND_MAX * 150.0f;
|
||||
void get_fake_data(int *speed, int mspeed, int *power, int mpower, int *bat, int mbat, float *tq, float mtq, int *rpm, int mrpm, float *eff, float meff, float *bat_temp, float mbat_temp, float *var_temp, float mvar_temp, float *mot_temp, float mmot_temp) {
|
||||
*speed = rand() % (mspeed + 1);
|
||||
*power = rand() % (mpower + 1);
|
||||
*bat = rand() % (mbat + 1);
|
||||
*tq = 1.8f + ((float)rand() / (float)RAND_MAX) * (mtq);
|
||||
*rpm = rand() % (mrpm + 1);
|
||||
*eff = (float)rand() / (float)RAND_MAX * meff;
|
||||
*bat_temp = (float)rand() / (float)RAND_MAX * mbat_temp;
|
||||
*var_temp = (float)rand() / (float)RAND_MAX * mvar_temp;
|
||||
*mot_temp = (float)rand() / (float)RAND_MAX * mmot_temp;
|
||||
}
|
||||
|
||||
long now_ms(void) {
|
||||
@ -242,11 +242,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
int speed = 0, power = 0, bat = 0, rpm = 0;
|
||||
float tq = 0.0f, eff = 0.0f, bat_temp = 0.0f, var_temp = 0.0f, mot_temp = 0.0f;
|
||||
int mspeed = 200, mpower = 1250, mbat = 100, mrpm = 6000;
|
||||
float mtq = 1.7f, meff = 300.0f, mbat_temp = 150.0f, mvar_temp = 150.0f, mmot_temp = 150.0f;
|
||||
long t100 = 0, t1000 = 0;
|
||||
int ch = ERR;
|
||||
while(ch == ERR) {
|
||||
if (fake_data) {
|
||||
get_fake_data(&speed, &power, &bat, &tq, &rpm, &eff, &bat_temp, &var_temp, &mot_temp);
|
||||
get_fake_data(&speed, mspeed, &power, mpower, &bat, mbat, &tq, mtq, &rpm, mrpm, &eff, meff, &bat_temp, mbat_temp, &var_temp, mvar_temp, &mot_temp, mmot_temp);
|
||||
} else {
|
||||
//real_data()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user