#define AO_LCO_BOX_DRAG 0 /* Box number to enable drag race mode (old LCO bits) */
#define AO_LCO_BOX_FIRST AO_LCO_BOX_DRAG
#else
-#define AO_LCO_LCO_VOLTAGE 0 /* Box number to show LCO voltage */
+# define AO_LCO_LCO_VOLTAGE 0 /* Box number to show LCO voltage */
+# ifdef AO_LCO_HAS_INFO
+# define AO_LCO_INFO -3
+# ifndef AO_LCO_BOX_FIRST
+# define AO_LCO_BOX_FIRST AO_LCO_INFO
+# endif
+# endif
# ifdef AO_LCO_HAS_BACKLIGHT
# define AO_LCO_BACKLIGHT -2
# ifndef AO_LCO_BOX_FIRST
#ifdef AO_LCO_BACKLIGHT
case AO_LCO_BACKLIGHT:
return true;
+#endif
+#ifdef AO_LCO_INFO
+ case AO_LCO_INFO:
+ return true;
#endif
default:
return false;
{
int16_t new_pad;
+ switch (ao_lco_box) {
#ifdef AO_LCO_HAS_CONTRAST
- if (ao_lco_box == AO_LCO_CONTRAST) {
+ case AO_LCO_CONTRAST: {
int32_t contrast = ao_lco_get_contrast();
contrast = (contrast + AO_LCO_CONTRAST_STEP - 1) / AO_LCO_CONTRAST_STEP;
if (contrast > AO_LCO_MAX_CONTRAST)
contrast = AO_LCO_MAX_CONTRAST;
ao_lco_set_contrast(contrast);
+ break;
}
#endif
#ifdef AO_LCO_HAS_BACKLIGHT
- if (ao_lco_box == AO_LCO_BACKLIGHT) {
+ case AO_LCO_BACKLIGHT: {
int32_t backlight = ao_lco_get_backlight();
backlight = (backlight + AO_LCO_BACKLIGHT_STEP - 1) / AO_LCO_BACKLIGHT_STEP;
if (backlight > AO_LCO_MAX_BACKLIGHT)
backlight = AO_LCO_MAX_BACKLIGHT;
ao_lco_set_backlight(backlight);
+ break;
}
#endif
- new_pad = (int16_t) ao_lco_pad;
- do {
- new_pad += dir;
- if (new_pad > AO_PAD_MAX_CHANNELS)
- new_pad = AO_LCO_PAD_VOLTAGE;
- if (new_pad < 0)
- new_pad = AO_PAD_MAX_CHANNELS;
- if (new_pad == ao_lco_pad)
- break;
- } while (!ao_lco_pad_present(ao_lco_box, (uint8_t) new_pad));
- PRINTD("New pad %d\n", new_pad);
- ao_lco_set_pad((uint8_t) new_pad);
+#ifdef AO_LCO_HAS_INFO
+ case AO_LCO_INFO: {
+#if AO_LCO_MIN_INFO_PAGE < AO_LCO_MAX_INFO_PAGE
+ int32_t info_page = ao_lco_get_info_page();
+
+ info += dir;
+ if (info_page < AO_LCO_MIN_INFO_PAGE)
+ info_page = AO_LCO_MIN_INFO_PAGE;
+ if (info_page > AO_LCO_MAX_INFO_PAGE)
+ info_page = AO_LCO_MAX_INFO_PAGE;
+ ao_lco_set_info_page();
+#endif
+ break;
+ }
+#endif
+ default:
+ new_pad = (int16_t) ao_lco_pad;
+ do {
+ new_pad += dir;
+ if (new_pad > AO_PAD_MAX_CHANNELS)
+ new_pad = AO_LCO_PAD_VOLTAGE;
+ if (new_pad < 0)
+ new_pad = AO_PAD_MAX_CHANNELS;
+ if (new_pad == ao_lco_pad)
+ break;
+ } while (!ao_lco_pad_present(ao_lco_box, (uint8_t) new_pad));
+ PRINTD("New pad %d\n", new_pad);
+ ao_lco_set_pad((uint8_t) new_pad);
+ break;
+ }
}
uint8_t
#define CONTRAST_X (WIDTH - CONTRAST_WIDTH) / 2
#define CONTRAST_Y 20
#define CONTRAST_HEIGHT 20
-
#define BACKLIGHT_LABEL_X 37
#define BACKLIGHT_WIDTH 100
#define BACKLIGHT_X (WIDTH - BACKLIGHT_WIDTH) / 2
#define BACKLIGHT_Y 20
#define BACKLIGHT_HEIGHT 20
+#define INFO_START_Y ((int16_t) (SMALL_FONT.ascent + 2))
+#define INFO_STEP_Y ((int16_t) (SMALL_FONT.ascent + 3))
#define AO_LCO_DRAG_RACE_START_TIME AO_SEC_TO_TICKS(5)
#define AO_LCO_DRAG_RACE_STOP_TIME AO_SEC_TO_TICKS(2)
ao_rect(&fb, BACKLIGHT_X, BACKLIGHT_Y, value, BACKLIGHT_HEIGHT, AO_BLACK, AO_COPY);
}
+static int16_t info_y;
+
+static void
+_ao_lco_info(const char *format, ...)
+{
+ va_list a;
+ char buf[20];
+ va_start(a, format);
+ vsnprintf(buf, sizeof(buf), format, a);
+ va_end(a);
+ ao_text(&fb, &SMALL_FONT, 0, info_y, buf, AO_BLACK, AO_COPY);
+ info_y += INFO_STEP_Y;
+}
+
+static void
+_ao_lco_show_info(void)
+{
+ info_y = INFO_START_Y;
+ _ao_lco_info("%s", ao_product);
+ _ao_lco_info("Version: %s", ao_version);
+ _ao_lco_info("Serial: %d", ao_serial_number);
+ _ao_lco_info("Callsign: %s", ao_config.callsign);
+ _ao_lco_info("Frequency: %ld.%03d",
+ ao_config.frequency / 1000,
+ (int) (ao_config.frequency % 1000));
+}
+
void
ao_lco_show(void)
{
case AO_LCO_BACKLIGHT:
_ao_lco_show_backlight();
break;
+ case AO_LCO_INFO:
+ _ao_lco_show_info();
+ break;
default:
if (ao_lco_pad == AO_LCO_PAD_VOLTAGE) {
_ao_lco_show_voltage(ao_pad_query.battery, "Pad battery");
#define AO_LCO_MAX_BACKLIGHT 65535
#define AO_LCO_BACKLIGHT_STEP 771
+#define AO_LCO_HAS_INFO 1
+#define AO_LCO_MIN_INFO_PAGE 0
+#define AO_LCO_MAX_INFO_PAGE 0
+
/*
* LCD Backlight via PWM.
*