Make hexagram_cluster_init() take fewer args
This commit is contained in:
parent
074554e03f
commit
9b4d3f4ae0
3 changed files with 15 additions and 20 deletions
|
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if ((cluster = hexagram_cluster_new(1200, 6500, 8000)) == NULL) {
|
||||
if ((cluster = hexagram_cluster_new()) == NULL) {
|
||||
perror("hexagram_cluster_new()");
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -36,16 +36,11 @@ typedef struct _hexagram_cluster {
|
|||
hexagram_gauge *gauges[HEXAGRAM_CLUSTER_GAUGE_COUNT];
|
||||
} hexagram_cluster;
|
||||
|
||||
int hexagram_cluster_init(hexagram_cluster *cluster,
|
||||
double rpm_min,
|
||||
double rpm_redline,
|
||||
double rpm_max);
|
||||
int hexagram_cluster_init(hexagram_cluster *cluster);
|
||||
|
||||
void hexagram_cluster_cleanup(hexagram_cluster *cluster);
|
||||
|
||||
hexagram_cluster *hexagram_cluster_new(double rpm_min,
|
||||
double rpm_redline,
|
||||
double rpm_max);
|
||||
hexagram_cluster *hexagram_cluster_new(void);
|
||||
|
||||
void hexagram_cluster_destroy(hexagram_cluster *cluster);
|
||||
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
#define CLUSTER_WIDTH 1280
|
||||
#define CLUSTER_HEIGHT 480
|
||||
|
||||
#define RPM_SHIFT_MIN 2000
|
||||
#define RPM_SHIFT_MAX 6500
|
||||
#define RPM_REDLINE 6500
|
||||
#define RPM_MAX 8000
|
||||
|
||||
#define SHIFT_INDICATOR_X 392
|
||||
#define SHIFT_INDICATOR_Y 24
|
||||
|
||||
|
@ -80,10 +85,7 @@ int hexagram_cluster_filter_can_if(hexagram_can_if *can_if) {
|
|||
sizeof(filters));
|
||||
}
|
||||
|
||||
int hexagram_cluster_init(hexagram_cluster *cluster,
|
||||
double rpm_min,
|
||||
double rpm_redline,
|
||||
double rpm_max) {
|
||||
int hexagram_cluster_init(hexagram_cluster *cluster) {
|
||||
cluster->width = CLUSTER_WIDTH;
|
||||
cluster->height = CLUSTER_HEIGHT;
|
||||
|
||||
|
@ -116,8 +118,8 @@ int hexagram_cluster_init(hexagram_cluster *cluster,
|
|||
CLUSTER_WIDTH - CLUSTER_HEIGHT / 2,
|
||||
CLUSTER_HEIGHT / 2,
|
||||
CLUSTER_HEIGHT / 2,
|
||||
rpm_redline,
|
||||
rpm_max) < 0) {
|
||||
RPM_REDLINE,
|
||||
RPM_MAX) < 0) {
|
||||
goto error_tacho_init;
|
||||
}
|
||||
|
||||
|
@ -155,8 +157,8 @@ int hexagram_cluster_init(hexagram_cluster *cluster,
|
|||
if (hexagram_tacho_shift_indicator_init(&cluster->shift_indicator,
|
||||
SHIFT_INDICATOR_X,
|
||||
SHIFT_INDICATOR_Y,
|
||||
rpm_min,
|
||||
rpm_redline) < 0) {
|
||||
RPM_SHIFT_MIN,
|
||||
RPM_SHIFT_MAX) < 0) {
|
||||
goto error_tacho_shift_indicator_init;
|
||||
}
|
||||
|
||||
|
@ -203,16 +205,14 @@ void hexagram_cluster_cleanup(hexagram_cluster *cluster) {
|
|||
hexagram_pattern_cleanup(&cluster->pattern);
|
||||
}
|
||||
|
||||
hexagram_cluster *hexagram_cluster_new(double rpm_min,
|
||||
double rpm_redline,
|
||||
double rpm_max) {
|
||||
hexagram_cluster *hexagram_cluster_new(void) {
|
||||
hexagram_cluster *cluster;
|
||||
|
||||
if ((cluster = malloc(sizeof(*cluster))) == NULL) {
|
||||
goto error_malloc_cluster;
|
||||
}
|
||||
|
||||
hexagram_cluster_init(cluster, rpm_min, rpm_redline, rpm_max);
|
||||
hexagram_cluster_init(cluster);
|
||||
|
||||
return cluster;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue