Platform:
Raspberry Pi OS Buster
LXPanel 0.10.0
The attached screenshot shows the second to last panel item is aligned to the ceiling while the last one is not.
Both plugins update the label identically:
Temperature (temp.c):
Code: Select all
static void update_display(Temp *pPlugin)
{
char output[16];
char faren[16];
exec("vcgencmd measure_temp | sed 's/temp=\\([0-9]\\+\\)\\.[0-9]\\+.C/\\1°C/'",output,16);
float far = atoi(output);
far *= 9.f/5.f;
far += 32;
snprintf(faren,16,"%.1f°F",far);
lxpanel_draw_label_text(pPlugin->panel, pPlugin->gLabel, output, TRUE, 1, TRUE);
gtk_widget_set_tooltip_text(pPlugin->gLabel, faren);
}
Code: Select all
static void update_display(Batt *pPlugin)
{
char output[16];
exec("python /home/pi/x750status.py",output,16);
char percent[16];
char voltage[16];
for (int i = 0;i < 16;++i)
{
if (output[i] == ' ')
{
percent[i] = '%';
percent[++i] = '\0';
strcpy(voltage,output+i);
voltage[4] = 'V';
voltage[5] = '\0';
break;
}
percent[i] = output[i];
}
lxpanel_draw_label_text(pPlugin->panel, pPlugin->gLabel, percent, TRUE, 1, TRUE);
gtk_widget_set_tooltip_text(pPlugin->gLabel, voltage);
}
Full sources:
temp.c https://hastebin.com/utorokorix.cpp
gpiobatt.c https://hastebin.com/izugadimuz.cpp