Skip to content

Commit 4c62d28

Browse files
committed
VERSION: bump to 3.2.0
- Fixed LCD shutdown image registration API. - Fixed Circle mode GPU load display. - Kept CPU/GPU Circle mode percentage visible at `100%`. - Increased Liquid Circle mode bar scale.
1 parent aad95f6 commit 4c62d28

8 files changed

Lines changed: 129 additions & 11 deletions

File tree

.SRCINFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = coolerdash
22
pkgdesc = Plug-in for CoolerControl that extends the LCD functionality with additional features
3-
pkgver = 3.1.5
3+
pkgver = 3.2.0
44
pkgrel = 1
55
url = https://github.com/damachine/coolerdash
66
install = coolerdash.install

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.5
1+
3.2.0

etc/coolercontrol/plugins/coolerdash/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"threshold_1": 30.0,
9393
"threshold_2": 35.0,
9494
"threshold_3": 40.0,
95-
"max_scale": 45.0,
95+
"max_scale": 60.0,
9696
"threshold_1_color": { "r": 0, "g": 255, "b": 0 },
9797
"threshold_2_color": { "r": 255, "g": 140, "b": 0 },
9898
"threshold_3_color": { "r": 255, "g": 70, "b": 0 },

etc/coolercontrol/plugins/coolerdash/ui/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ <h3 class="section-title">System Environment</h3>
12781278
threshold_1: 30.0,
12791279
threshold_2: 35.0,
12801280
threshold_3: 40.0,
1281-
max_scale: 45.0,
1281+
max_scale: 60.0,
12821282
font_size_temp: 0,
12831283
label: '',
12841284
threshold_1_color: { r: 0, g: 255, b: 0 },
@@ -1887,7 +1887,7 @@ <h3 class="section-title">System Environment</h3>
18871887
defaults.threshold_1 = 30.0;
18881888
defaults.threshold_2 = 35.0;
18891889
defaults.threshold_3 = 40.0;
1890-
defaults.max_scale = 45.0;
1890+
defaults.max_scale = 60.0;
18911891
} else if (/RPM|rpm/.test(sensorId)) {
18921892
defaults.threshold_1 = 500;
18931893
defaults.threshold_2 = 1000;

src/device/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ static void set_default_sensor_configs(Config *config)
412412
liquid->threshold_2 = 35.0f;
413413
if (liquid->threshold_3 == 0.0f)
414414
liquid->threshold_3 = 40.0f;
415-
if (liquid->max_scale == 0.0f)
416-
liquid->max_scale = 45.0f;
415+
if (liquid->max_scale == 0.0f || liquid->max_scale == 45.0f)
416+
liquid->max_scale = 60.0f;
417417
}
418418
}
419419

src/mods/circle.c

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,53 @@ static void draw_single_sensor(cairo_t *cr, const struct Config *config,
621621
(safe_width * left_margin_factor);
622622
double duty_y = value_layout.baseline_y;
623623

624-
/* Don't overlap with temperature block */
625-
double duty_right = duty_x + duty_total_width +
626-
scale_value_avg(params, 4.0);
627-
if (duty_right <= value_layout.block_left)
624+
const double overlap_padding =
625+
fmax(1.0, scale_value_avg(params, 2.0));
626+
double duty_available_width =
627+
value_layout.block_left - duty_x - overlap_padding;
628+
if (duty_available_width <= 0.0)
628629
{
630+
duty_x = safe_x;
631+
duty_available_width =
632+
value_layout.block_left - duty_x - overlap_padding;
633+
}
634+
635+
const double min_duty_font =
636+
fmax(8.0, value_layout.font_size * 0.32);
637+
while (duty_total_width > duty_available_width &&
638+
duty_font > min_duty_font)
639+
{
640+
duty_font *= 0.90;
641+
if (duty_font < min_duty_font)
642+
duty_font = min_duty_font;
643+
644+
pct_font = duty_font / 2.05;
645+
cairo_set_font_size(cr, duty_font);
646+
cairo_font_extents(cr, &duty_fext);
647+
cairo_text_extents(cr, duty_buf, &duty_text_ext);
648+
649+
cairo_set_font_size(cr, pct_font);
650+
cairo_text_extents(cr, "%", &pct_ext);
651+
cairo_set_font_size(cr, duty_font);
652+
653+
duty_number_width =
654+
fmax(duty_text_ext.x_advance, duty_text_ext.width);
655+
duty_total_width = duty_number_width + pct_spacing +
656+
fmax(pct_ext.x_advance, pct_ext.width);
657+
}
658+
659+
if (duty_total_width > duty_available_width)
660+
{
661+
duty_x = fmax(safe_x,
662+
value_layout.block_left - duty_total_width -
663+
overlap_padding);
664+
duty_available_width =
665+
value_layout.block_left - duty_x - overlap_padding;
666+
}
667+
668+
if (duty_available_width > 0.0)
669+
{
670+
cairo_set_font_size(cr, duty_font);
629671
set_cairo_color(cr, value_color);
630672
cairo_move_to(cr, duty_x, duty_y);
631673
cairo_show_text(cr, duty_buf);

src/srv/cc_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ const char *get_session_access_token(void)
276276
static void reset_curl_request_options(void)
277277
{
278278
curl_easy_setopt(cc_session.curl_handle, CURLOPT_POSTFIELDS, NULL);
279+
curl_easy_setopt(cc_session.curl_handle, CURLOPT_MIMEPOST, NULL);
279280
curl_easy_setopt(cc_session.curl_handle, CURLOPT_CUSTOMREQUEST, NULL);
280281
curl_easy_setopt(cc_session.curl_handle, CURLOPT_WRITEFUNCTION, NULL);
281282
curl_easy_setopt(cc_session.curl_handle, CURLOPT_WRITEDATA, NULL);
@@ -487,6 +488,7 @@ int register_lcd_shutdown_image_with_cc(const Config *config,
487488
headers = curl_slist_append(headers, cc_session.access_token);
488489

489490
curl_easy_setopt(cc_session.curl_handle, CURLOPT_URL, url);
491+
curl_easy_setopt(cc_session.curl_handle, CURLOPT_CUSTOMREQUEST, "PUT");
490492
curl_easy_setopt(cc_session.curl_handle, CURLOPT_MIMEPOST, mime);
491493
curl_easy_setopt(
492494
cc_session.curl_handle, CURLOPT_WRITEFUNCTION,

src/srv/cc_sensor.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// Include necessary headers
1515
// cppcheck-suppress-begin missingIncludeSystem
16+
#include <ctype.h>
1617
#include <curl/curl.h>
1718
#include <jansson.h>
1819
#include <stdio.h>
@@ -29,6 +30,41 @@
2930
/** @brief Cached CURL handle for sensor polling. */
3031
static CURL *sensor_curl_handle = NULL;
3132

33+
static int contains_ci(const char *haystack, const char *needle)
34+
{
35+
if (!haystack || !needle || needle[0] == '\0')
36+
return 0;
37+
38+
const size_t needle_len = strlen(needle);
39+
for (const char *p = haystack; *p; p++)
40+
{
41+
size_t i = 0;
42+
while (i < needle_len && p[i] &&
43+
tolower((unsigned char)p[i]) ==
44+
tolower((unsigned char)needle[i]))
45+
{
46+
i++;
47+
}
48+
if (i == needle_len)
49+
return 1;
50+
}
51+
return 0;
52+
}
53+
54+
static int is_cooling_duty_name(const char *name)
55+
{
56+
return contains_ci(name, "fan") || contains_ci(name, "pump") ||
57+
contains_ci(name, "cooler") || contains_ci(name, "cooling");
58+
}
59+
60+
static int is_load_duty_name(const char *name)
61+
{
62+
return contains_ci(name, "load") || contains_ci(name, "usage") ||
63+
contains_ci(name, "util") || contains_ci(name, "activity") ||
64+
contains_ci(name, "process") || contains_ci(name, "processor") ||
65+
contains_ci(name, "gpu") || contains_ci(name, "cpu");
66+
}
67+
3268
/** @brief Init or return cached CURL handle. */
3369
static CURL *get_sensor_curl_handle(void)
3470
{
@@ -416,6 +452,41 @@ static const char *get_legacy_slot_device_type(const char *slot_value)
416452
return NULL;
417453
}
418454

455+
static const sensor_entry_t *find_preferred_legacy_duty_sensor(
456+
const monitor_sensor_data_t *data, const char *slot_value,
457+
const char *target_type)
458+
{
459+
const sensor_entry_t *first_matching = NULL;
460+
const sensor_entry_t *first_non_cooling = NULL;
461+
462+
for (int i = 0; i < data->sensor_count; i++)
463+
{
464+
const sensor_entry_t *sensor = &data->sensors[i];
465+
if (sensor->category != SENSOR_CATEGORY_DUTY ||
466+
strcmp(sensor->device_type, target_type) != 0)
467+
continue;
468+
469+
if (!first_matching)
470+
first_matching = sensor;
471+
472+
if (!is_cooling_duty_name(sensor->name))
473+
{
474+
if (!first_non_cooling)
475+
first_non_cooling = sensor;
476+
if (is_load_duty_name(sensor->name))
477+
return sensor;
478+
}
479+
}
480+
481+
if (strcmp(slot_value, "gpu") == 0)
482+
{
483+
/* Avoid rendering GPU fan duty as GPU processor utilisation. */
484+
return first_non_cooling;
485+
}
486+
487+
return first_non_cooling ? first_non_cooling : first_matching;
488+
}
489+
419490
/**
420491
* @brief Resolve a legacy slot value to matching sensor entry.
421492
* @details Maps "cpu"→first CPU sensor, "gpu"→first GPU sensor,
@@ -432,6 +503,9 @@ static const sensor_entry_t *resolve_legacy_slot(
432503
if (!target_type)
433504
return NULL;
434505

506+
if (category == SENSOR_CATEGORY_DUTY)
507+
return find_preferred_legacy_duty_sensor(data, slot_value, target_type);
508+
435509
for (int i = 0; i < data->sensor_count; i++)
436510
{
437511
if (data->sensors[i].category == category &&

0 commit comments

Comments
 (0)