Compare commits

..

No commits in common. "45dffd54ad702e63d7fa0977c492b6136c998a57" and "c09f0a81b05071127f855a5237be7dcd27d0167c" have entirely different histories.

View File

@ -12,7 +12,6 @@
#include <net/if.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
const int digit_bitmaps[10][5][3] = {
{{1,1,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}}, // 0
@ -173,35 +172,6 @@ void read_uart(Tel *t, int fd, SerialParser *uart_str) {
}
}
void write_uart(Tel *t, int fd) {
// speed,rpm,power,eff,bat,tens,amp,warn
char msg[256];
int len = snprintf(msg, sizeof(msg), "%d,%d,%d,%.1f,%d,%.1f,%.1f,%d\n",
t->speed.data,
t->rpm.data,
t->power.data,
t->eff.data,
t->bat.data,
t->tens.data,
t->amp.data,
t->message.error_level );
if (len < 0 || len >= (int)sizeof(msg)) {
return;
}
int total = 0;
while (total < len) {
int n = write(fd, msg + total, len - total);
if (n < 0) {
if (errno == EINTR) continue;
if (errno == EAGAIN) continue;
return;
}
total += n;
}
}
void calc_data(Tel *t, Bat_state *b, long now) {
t->power.data = (int)(t->tens.data * t->amp.data);
t->speed.data = (int)(t->rpm.data * 0.017f);
@ -218,7 +188,6 @@ void calc_data(Tel *t, Bat_state *b, long now) {
b->previous_ms = now;
b->wh_used += (float)t->power.data * (float)dt / 3600000.0f;
if (b->wh_used > b->wh_total) b->wh_used = b->wh_total;
}
long now_ms(void) {
@ -686,9 +655,6 @@ int main(int argc, char **argv) {
win_float(&tel.amp, use_color);
win_int(&tel.bat, use_color);
win_warn(&tel, use_color, now);
if (use_uart) write_uart(&tel, uart_fd);
t100 = now;
}
napms(10);