1103 lines
26 KiB
C
1103 lines
26 KiB
C
|
|
/*
|
||
|
|
* display.c
|
||
|
|
*
|
||
|
|
* Created on: Jun 17, 2022
|
||
|
|
* Author: Keith.Lloyd
|
||
|
|
*/
|
||
|
|
|
||
|
|
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <math.h>
|
||
|
|
#include <stdbool.h>
|
||
|
|
#include <string.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <arm_math.h>
|
||
|
|
#include "fsl_gpio.h"
|
||
|
|
|
||
|
|
#include "spi.h"
|
||
|
|
#include "lcd.h"
|
||
|
|
#include "display.h"
|
||
|
|
#include "frq.h"
|
||
|
|
#include "battery.h"
|
||
|
|
#include "utils.h"
|
||
|
|
#include "Graphics/splash.h"
|
||
|
|
|
||
|
|
#include "Graphics/graphicsLibrary.h"
|
||
|
|
#include "Fonts/fontLibrary.h"
|
||
|
|
#include "Graphics/testIconsMono.h"
|
||
|
|
#include "Graphics/icons.h"
|
||
|
|
#include "adc.h"
|
||
|
|
#include "mode.h"
|
||
|
|
#include "ports.h"
|
||
|
|
#include "timer.h"
|
||
|
|
#include "taps.h"
|
||
|
|
#include "main.h"
|
||
|
|
#include "hwFixes.h"
|
||
|
|
#include "menu.h"
|
||
|
|
#include "System\system.h"
|
||
|
|
|
||
|
|
uint8_t tempString[40]; // Todo move
|
||
|
|
uint8_t frequency = 0;
|
||
|
|
uint32_t new_freq;
|
||
|
|
float32_t Volts = 96.345;
|
||
|
|
|
||
|
|
uint16_t Bcast_Pwr_Dispval[5] = {0,25,50,75,100}; // broadcast value to display.
|
||
|
|
uint32_t Safety_Select = false;
|
||
|
|
float32_t Milli_amps;
|
||
|
|
float32_t Watts_Filt;
|
||
|
|
|
||
|
|
extern SYSTEM_DATA_t sys;
|
||
|
|
|
||
|
|
extern ADC_t adc;
|
||
|
|
extern uint8_t Bat_Type, Cur_Mode, Task, Over_Voltage_Flag, Error;
|
||
|
|
extern MODE_REC_t mode_Array[];
|
||
|
|
extern uint8_t Bcast_Pwr_Level;
|
||
|
|
extern uint8_t Power_Level,Test_Mode,LD_Flag;
|
||
|
|
extern float32_t volts_check;
|
||
|
|
extern uint8_t Port_State[];
|
||
|
|
extern uint8_t Dds_Pot_Val[];
|
||
|
|
extern HARDWARE_FIX_t hwf;
|
||
|
|
extern float32_t test_val2;
|
||
|
|
|
||
|
|
extern uint32_t systemTime;
|
||
|
|
extern ClampData_t clampData;
|
||
|
|
|
||
|
|
void Display_Bcast(void)
|
||
|
|
{
|
||
|
|
if(Cur_Mode == BROADCAST)
|
||
|
|
{
|
||
|
|
sprintf(tempString,"%d%%",Bcast_Pwr_Dispval[Bcast_Pwr_Level]);
|
||
|
|
FL_DrawString( tempString, LCD_X_MID, 60, font18Bold, LCD_DRAW_SET, FL_ALIGN_CENTER);
|
||
|
|
Display_Level(Bcast_Pwr_Level);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
void Display_USB(void)
|
||
|
|
{
|
||
|
|
GL_DrawMonoBitmap(usbIconSmall, LCD_X_MID-16, LCD_Y_MID, LCD_DRAW_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
void Display_Splash(void)
|
||
|
|
{
|
||
|
|
LCD_Clear();
|
||
|
|
|
||
|
|
|
||
|
|
// if(Read_Model_type() != LEICA)
|
||
|
|
// GL_DrawMonoBitmapCentered(UMLogo68x64, LCD_DRAW_SET);
|
||
|
|
// else
|
||
|
|
// GL_DrawMonoBitmapCentered(leicaSplash, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// LCD_Update();
|
||
|
|
|
||
|
|
|
||
|
|
switch(Read_Model_type())
|
||
|
|
{
|
||
|
|
case UMAG:
|
||
|
|
GL_DrawMonoBitmapCentered(UMLogo68x64, LCD_DRAW_SET);
|
||
|
|
break;
|
||
|
|
|
||
|
|
case LEICA:
|
||
|
|
GL_DrawMonoBitmapCentered(leicaSplash, LCD_DRAW_SET);
|
||
|
|
break;
|
||
|
|
|
||
|
|
case GLAND:
|
||
|
|
GL_DrawMonoBitmapCentered(goldenlandLogo98x60, LCD_DRAW_SET);
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
GL_DrawMonoBitmapCentered(UMLogo68x64, LCD_DRAW_SET);
|
||
|
|
break;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
LCD_Update();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
uint8_t Read_Model_type()
|
||
|
|
{
|
||
|
|
|
||
|
|
if(strncmp(sys.modelName,"10W",3) == 0 )
|
||
|
|
return(UMAG);
|
||
|
|
if(strncmp(sys.modelName,"DE100",5) == 0 )
|
||
|
|
return(LEICA);
|
||
|
|
if(strncmp(sys.modelName,"GT3",3) == 0 )
|
||
|
|
return(GLAND);
|
||
|
|
if(strncmp(sys.modelName,"Nexus",5) == 0 )
|
||
|
|
return(UMAG);
|
||
|
|
if(strncmp(sys.modelName,"Tx10",4) == 0 )
|
||
|
|
return(UMAG);
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
void Display_Volts(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
if((( Cur_Mode != BROADCAST) && (!Is_Clamp_Detected())))
|
||
|
|
Display_Line_Voltage();
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if((Is_Clamp_Detected()) && (Test_Mode) && (Cur_Mode != BROADCAST))
|
||
|
|
{
|
||
|
|
Display_Clamp_Power();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#if 0// testing the new averager
|
||
|
|
sprintf(tempString,"%.2fmA",adc.I_OUT_SlowFilt* 1000.0);
|
||
|
|
FL_DrawString( tempString, X_POS_MA+50, 18, font16Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
void Display_Line_Voltage(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
Volts = adc.V_OUT_FastFilt;
|
||
|
|
|
||
|
|
if(Volts < 0)
|
||
|
|
Volts = 0;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.0fVa",Volts);
|
||
|
|
FL_DrawString( tempString, X_POS_MA+90, 48, font16Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
GL_DrawLine( X_POS_MA+90, 74, X_POS_MA+130, 74, 3, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Clamp_Power(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
float power = 0.0f;
|
||
|
|
|
||
|
|
Volts = adc.V_OUT_FastFilt;
|
||
|
|
if(Volts < 0)
|
||
|
|
Volts = 0;
|
||
|
|
|
||
|
|
power = Volts * adc.I_OUT_FastFilt;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.1fW", power);
|
||
|
|
FL_DrawString( tempString, LCD_X_MID -10, 60, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Clamp_Volts(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
Volts = adc.V_OUT_FastFilt;
|
||
|
|
if(Volts < 0)
|
||
|
|
Volts = 0;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.0fVb",Volts);
|
||
|
|
FL_DrawString( tempString, LCD_X_MID -10, 60, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Current(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
if(( Cur_Mode != BROADCAST) && (!Is_Clamp_Detected()))
|
||
|
|
Display_Line_Current();
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if((Is_Clamp_Detected()) && (Test_Mode))
|
||
|
|
Display_Line_Current();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Ohms(void)
|
||
|
|
{
|
||
|
|
if(( Cur_Mode != BROADCAST) && (!Is_Clamp_Detected()))
|
||
|
|
Display_Line_Ohms();
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if((Is_Clamp_Detected()) && (Test_Mode))
|
||
|
|
Display_Line_Ohms();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Line_Current(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
Milli_amps = adc.I_OUT_SlowFilt;
|
||
|
|
|
||
|
|
|
||
|
|
if(Milli_amps < 0)
|
||
|
|
Milli_amps = 0;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.0fmA =",Milli_amps * 1000.0);
|
||
|
|
FL_DrawString( tempString, X_POS_MA+85, 60, font16Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Line_Ohms(void)
|
||
|
|
{
|
||
|
|
if(adc.Ohms_slowfilt < 0)
|
||
|
|
adc.Ohms_slowfilt = 0;
|
||
|
|
|
||
|
|
|
||
|
|
if(adc.Ohms_slowfilt < 10000)
|
||
|
|
{
|
||
|
|
sprintf(tempString,"%.0fΩ",adc.Ohms_slowfilt);
|
||
|
|
FL_DrawString( tempString, X_POS_MA+90, 72, font16Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if(adc.Ohms_slowfilt < 100000)
|
||
|
|
{
|
||
|
|
sprintf(tempString,"%.0f kΩ",adc.Ohms_slowfilt/1000);
|
||
|
|
FL_DrawString( tempString, X_POS_MA+90, 72, font16Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
FL_DrawString( "- - - Ω", X_POS_MA+90, 72, font16Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Watts(void)
|
||
|
|
{
|
||
|
|
if(( Cur_Mode != BROADCAST) && (!Is_Clamp_Detected()))
|
||
|
|
{
|
||
|
|
|
||
|
|
if(Watts_Filt < 0)
|
||
|
|
Watts_Filt = 0;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.1fW",Watts_Filt );
|
||
|
|
FL_DrawString( tempString, LCD_X_MAX+4, LCD_Y_MAX-40, font16Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Line_Watts(void)
|
||
|
|
{
|
||
|
|
if(Watts_Filt < 0)
|
||
|
|
Watts_Filt = 0;
|
||
|
|
|
||
|
|
sprintf(tempString,"%.1fW",Watts_Filt );
|
||
|
|
FL_DrawString( tempString, LCD_X_MAX+4, LCD_Y_MAX-40, font16Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_BroadCastSignal(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Battery(void)
|
||
|
|
{
|
||
|
|
if(Bat_Type != EXT_DC)
|
||
|
|
{
|
||
|
|
if(hwf.vBattCap_021)
|
||
|
|
Display_Battery_CF();
|
||
|
|
else
|
||
|
|
Display_Battery_NC();
|
||
|
|
}
|
||
|
|
|
||
|
|
else
|
||
|
|
Display_EXT_DC();
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_EXT_DC(void)
|
||
|
|
{
|
||
|
|
sprintf(tempString, "EXT_DC");
|
||
|
|
FL_DrawString(tempString, 0, LCD_Y_MAX - 22, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Battery_NC() // No Cap
|
||
|
|
{
|
||
|
|
|
||
|
|
// battery = Adjust_Battery_For_Load(); //adjust battery dependant on load and Vdrop
|
||
|
|
|
||
|
|
|
||
|
|
if (Bat_Type == LITHIUM)
|
||
|
|
{
|
||
|
|
if(adc.V_BAT >= NCL_BATTERY_NINETY)
|
||
|
|
Draw_Battery(STACKS_4);
|
||
|
|
else if(adc.V_BAT > NCL_BATTERY_3QUARTERS)
|
||
|
|
Draw_Battery(STACKS_3);
|
||
|
|
else if(adc.V_BAT > NCL_BATTERY_FIFTY)
|
||
|
|
Draw_Battery(STACKS_2);
|
||
|
|
else if(adc.V_BAT > NCL_BATTERY_1QUARTER)
|
||
|
|
Draw_Battery(STACKS_1);
|
||
|
|
else if (adc.V_BAT > NCL_BATTERY_1EIGTH)
|
||
|
|
Draw_Battery(STACKS_EMPTY);
|
||
|
|
else
|
||
|
|
Display_Bat_Frame_Flash();
|
||
|
|
}
|
||
|
|
|
||
|
|
else
|
||
|
|
{
|
||
|
|
|
||
|
|
if(adc.V_BAT >= NCA_BATTERY_NINETY)
|
||
|
|
Draw_Battery(STACKS_4);
|
||
|
|
else if(adc.V_BAT > NCA_BATTERY_3QUARTERS)
|
||
|
|
Draw_Battery(STACKS_3);
|
||
|
|
else if(adc.V_BAT > NCA_BATTERY_FIFTY)
|
||
|
|
Draw_Battery(STACKS_2);
|
||
|
|
else if(adc.V_BAT > NCA_BATTERY_1QUARTER)
|
||
|
|
Draw_Battery(STACKS_1);
|
||
|
|
else if (adc.V_BAT > NCA_BATTERY_1EIGTH)
|
||
|
|
Draw_Battery(STACKS_EMPTY);
|
||
|
|
else
|
||
|
|
Display_Bat_Frame_Flash();
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Battery_CF() // cap fitted
|
||
|
|
{
|
||
|
|
|
||
|
|
// battery = Adjust_Battery_For_Load(); //adjust battery dependant on load and Vdrop
|
||
|
|
|
||
|
|
|
||
|
|
if (Bat_Type == LITHIUM)
|
||
|
|
{
|
||
|
|
if(adc.V_BAT >= L_BATTERY_NINETY)
|
||
|
|
Draw_Battery(STACKS_4);
|
||
|
|
else if(adc.V_BAT > L_BATTERY_3QUARTERS)
|
||
|
|
Draw_Battery(STACKS_3);
|
||
|
|
else if(adc.V_BAT > L_BATTERY_FIFTY)
|
||
|
|
Draw_Battery(STACKS_2);
|
||
|
|
else if(adc.V_BAT > L_BATTERY_1QUARTER)
|
||
|
|
Draw_Battery(STACKS_1);
|
||
|
|
else if (adc.V_BAT > L_BATTERY_1EIGTH)
|
||
|
|
Draw_Battery(STACKS_EMPTY);
|
||
|
|
else
|
||
|
|
Display_Bat_Frame_Flash();
|
||
|
|
}
|
||
|
|
|
||
|
|
else
|
||
|
|
{
|
||
|
|
|
||
|
|
if(adc.V_BAT >= A_BATTERY_NINETY)
|
||
|
|
Draw_Battery(STACKS_4);
|
||
|
|
else if(adc.V_BAT > A_BATTERY_3QUARTERS)
|
||
|
|
Draw_Battery(STACKS_3);
|
||
|
|
else if(adc.V_BAT > A_BATTERY_FIFTY)
|
||
|
|
Draw_Battery(STACKS_2);
|
||
|
|
else if(adc.V_BAT > A_BATTERY_1QUARTER)
|
||
|
|
Draw_Battery(STACKS_1);
|
||
|
|
else if (adc.V_BAT > A_BATTERY_1EIGTH)
|
||
|
|
Draw_Battery(STACKS_EMPTY);
|
||
|
|
else
|
||
|
|
Display_Bat_Frame_Flash();
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void Draw_Battery(uint8_t stacks)
|
||
|
|
{
|
||
|
|
uint16_t battx = 0;
|
||
|
|
uint16_t batty = LCD_Y_MAX - GL_GetMonoBitmapHeight(battery0)+3;
|
||
|
|
|
||
|
|
switch(stacks)
|
||
|
|
{
|
||
|
|
case STACKS_4:
|
||
|
|
GL_DrawMonoBitmap(battery4, battx, batty, LCD_DRAW_SET); // Draw all 4
|
||
|
|
GL_DrawMonoBitmap(battery3, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery2, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery1, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case STACKS_3:
|
||
|
|
GL_DrawMonoBitmap(battery3, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery2, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery1, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case STACKS_2:
|
||
|
|
GL_DrawMonoBitmap(battery2, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery1, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case STACKS_1:
|
||
|
|
GL_DrawMonoBitmap(battery1, battx, batty, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case STACKS_0:
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Bat_Frame_Flash(void)
|
||
|
|
{
|
||
|
|
static uint8_t flasher = 0;
|
||
|
|
|
||
|
|
uint16_t battx = 0;
|
||
|
|
uint16_t batty = LCD_Y_MAX - GL_GetMonoBitmapHeight(battery0)+3;
|
||
|
|
|
||
|
|
if(flasher > 3)
|
||
|
|
{
|
||
|
|
GL_DrawMonoBitmap(battery0, battx, batty, LCD_DRAW_SET);
|
||
|
|
flasher = 0;
|
||
|
|
|
||
|
|
}
|
||
|
|
else
|
||
|
|
flasher++;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Wireless(uint8_t wireless)
|
||
|
|
{
|
||
|
|
if(wireless)
|
||
|
|
GL_DrawMonoBitmap(txControl, LCD_X_MID-90, LCD_Y_MAX-22, LCD_DRAW_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Mode(uint8_t Con_Mode1)
|
||
|
|
{
|
||
|
|
uint8_t What; // What to display
|
||
|
|
|
||
|
|
// Con_Mode1 = Cur_Mode; // Currently indexed is the selected.
|
||
|
|
|
||
|
|
// mod_Array[Cur_Mode].Select = false;
|
||
|
|
|
||
|
|
//What = mode_Array[Cur_Mode].Plugged;
|
||
|
|
|
||
|
|
switch(Con_Mode1) // Where to draw
|
||
|
|
{
|
||
|
|
case BROADCAST:
|
||
|
|
//GL_DrawMonoBitmap(border60x60, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
// GL_DrawMonoBitmap(clampIcon2, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
// GL_DrawMonoBitmap(directConnectIcon3, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
// GL_DrawMonoBitmap(directConnectIcon5, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
GL_DrawMonoBitmap(inductionIcon, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
// GL_DrawMonoBitmap(lamp, LCD_X_MAX-28,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT1_A: // ACtually PORT 2
|
||
|
|
What = ACCY_GetConnectedAccessory(1);
|
||
|
|
// What = ID_TX_DUAL_DIRECT; // Test
|
||
|
|
if(What == ID_CLAMP || What == ID_CLAMP2)
|
||
|
|
GL_DrawMonoBitmap(clampIcon2, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET);
|
||
|
|
if(What == ID_TX_SINGLE_DIRECT)
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon5, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
if(What == ID_TX_DUAL_DIRECT)
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon3, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
if (What == ID_TX_DUAL_DIRECT)
|
||
|
|
FL_DrawString("1A", LCD_X_MAX-40, LCD_Y_MIN+5, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
else
|
||
|
|
FL_DrawString("1", LCD_X_MAX-40, LCD_Y_MIN, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT1_B: //can only be lower half of Dual
|
||
|
|
// GL_DrawMonoBitmap(box_unchecked, LCD_X_MAX-44, LCD_Y_MIN + 24, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(189, 0, 239, 49, 1, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(179, 0, 239, 59, 1, LCD_DRAW_SET);
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon3, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
FL_DrawString("1B", LCD_X_MAX-40, LCD_Y_MIN+29, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT2_A:
|
||
|
|
What = ACCY_GetConnectedAccessory(2);
|
||
|
|
|
||
|
|
if(What == ID_CLAMP || What == ID_CLAMP2)
|
||
|
|
GL_DrawMonoBitmap(clampIcon2, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET);
|
||
|
|
if(What == ID_TX_SINGLE_DIRECT)
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon5, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
if(What == ID_TX_DUAL_DIRECT)
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon3, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
|
||
|
|
if (What == ID_TX_DUAL_DIRECT)
|
||
|
|
FL_DrawString("2A", LCD_X_MAX-40, LCD_Y_MIN+5, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
else
|
||
|
|
FL_DrawString("2", LCD_X_MAX-40, LCD_Y_MIN, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
break;
|
||
|
|
case PORT2_B: //can only be lower half of Dual
|
||
|
|
GL_DrawMonoBitmap(directConnectIcon3, LCD_X_MAX-60,LCD_Y_MIN + 2, LCD_DRAW_SET); // Always draw
|
||
|
|
FL_DrawString("2B", LCD_X_MAX-40, LCD_Y_MIN+29, font12Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#if 0
|
||
|
|
void Display_Connection(CON_MODE_t Con_Output1, CON_MODE_t Con_Output2)
|
||
|
|
{
|
||
|
|
|
||
|
|
switch(Con_Output1)
|
||
|
|
{
|
||
|
|
case A1:
|
||
|
|
FL_DrawString("A1", LCD_X_MAX -48, LCD_Y_MIN , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case A2:
|
||
|
|
FL_DrawString("A2", LCD_X_MAX-48, LCD_Y_MIN , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case B1:
|
||
|
|
FL_DrawString("B1", LCD_X_MAX-48, LCD_Y_MIN , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case B2:
|
||
|
|
FL_DrawString("B2", LCD_X_MAX-48, LCD_Y_MIN , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
switch(Con_Output2)
|
||
|
|
{
|
||
|
|
case A1:
|
||
|
|
FL_DrawString("A1", LCD_X_MAX -48, LCD_Y_MIN+48 , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case A2:
|
||
|
|
FL_DrawString("A2", LCD_X_MAX-48, LCD_Y_MIN+48 , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case B1:
|
||
|
|
FL_DrawString("B1", LCD_X_MAX-48, LCD_Y_MIN+48 , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
case B2:
|
||
|
|
FL_DrawString("B2", LCD_X_MAX-48, LCD_Y_MIN+48 , font14Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
break;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void Display_Level(PWR_MODE_t Level)
|
||
|
|
{
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// Print all bars
|
||
|
|
|
||
|
|
switch(Level)
|
||
|
|
{
|
||
|
|
case LEVEL0:
|
||
|
|
// GL_DrawMonoBitmap(power0, LCD_X_MID-60, LCD_Y_MID-64, LCD_DRAW_SET);
|
||
|
|
GL_DrawRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
// GL_DrawFilledRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET); //second
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET); //third
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET); //fourth
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case LEVEL1:
|
||
|
|
// GL_DrawMonoBitmap(power1, LCD_X_MID-60, LCD_Y_MID-64, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
GL_DrawRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
GL_DrawFilledRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
break;
|
||
|
|
|
||
|
|
case LEVEL2:
|
||
|
|
// GL_DrawMonoBitmap(power2, LCD_X_MID-60, LCD_Y_MID-64, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
GL_DrawRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
GL_DrawFilledRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
break;
|
||
|
|
|
||
|
|
case LEVEL3:
|
||
|
|
// GL_DrawMonoBitmap(power3, LCD_X_MID-60,LCD_Y_MID-64, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
GL_DrawRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
GL_DrawFilledRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1,LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
// GL_DrawMonoBitmap(power4, LCD_X_MID-60, LCD_Y_MID-64, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
GL_DrawRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, 2, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
GL_DrawFilledRectangle(70, LCD_Y_MIN+15, 90, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(94, LCD_Y_MIN+15, 114, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(118, LCD_Y_MIN+15, 138, LCD_Y_MIN + 1,LCD_DRAW_SET); //first
|
||
|
|
GL_DrawFilledRectangle(142, LCD_Y_MIN+15, 162, LCD_Y_MIN + 1, LCD_DRAW_SET); //first
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Backlight(uint8_t Back_Light)
|
||
|
|
{
|
||
|
|
if (Back_Light)
|
||
|
|
GL_DrawMonoBitmap(lamp, LCD_X_MIN+0, LCD_Y_MIN+30, LCD_DRAW_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_High_Voltage(void)
|
||
|
|
{
|
||
|
|
GL_DrawMonoBitmap(highVoltageIcon, LCD_X_MIN+0, LCD_Y_MIN+0, LCD_DRAW_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Frequency(uint8_t frequency)
|
||
|
|
{
|
||
|
|
// if (freqArray[frequency].frequency2 > 0)
|
||
|
|
// Display_CD_Symbol(); // place a CD symbol in front in correct position
|
||
|
|
|
||
|
|
if(LD_Flag)
|
||
|
|
Display_CD_Symbol(); // place a CD symbol in front in correct position
|
||
|
|
|
||
|
|
if (freqArray[frequency].frequency1 < 1000)
|
||
|
|
sprintf(tempString,"%dHz", freqArray[frequency].frequency1);
|
||
|
|
|
||
|
|
if (freqArray[frequency].frequency1 < 10000 && freqArray[frequency].frequency1 >= 1000 )
|
||
|
|
sprintf(tempString,"%.2fkHz", (float32_t)freqArray[frequency].frequency1/1000.0 );
|
||
|
|
|
||
|
|
if (freqArray[frequency].frequency1 < 100000 && freqArray[frequency].frequency1 >= 10000)
|
||
|
|
sprintf(tempString,"%.1fkHz",(float32_t)freqArray[frequency].frequency1/1000 );
|
||
|
|
|
||
|
|
if (freqArray[frequency].frequency1 > 100000)
|
||
|
|
// {
|
||
|
|
// if(freqArray[frequency].frequency1 == 131148)
|
||
|
|
// sprintf(tempString,"%.0fKHz",(float32_t)132000/1000 );
|
||
|
|
// else
|
||
|
|
sprintf(tempString,"%.0fKHz",(float32_t)freqArray[frequency].frequency1/1000 );
|
||
|
|
// }
|
||
|
|
|
||
|
|
FL_DrawString( tempString, LCD_X_MAX+6, LCD_Y_MAX - 22, font18Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_CD_Symbol(void)
|
||
|
|
{
|
||
|
|
// uint16_t ldy = LCD_Y_MAX - GL_GetMonoBitmapHeight(ld2)+3;
|
||
|
|
|
||
|
|
|
||
|
|
if (freqArray[frequency].frequency1 < 1000)
|
||
|
|
GL_DrawMonoBitmap(ld, LCD_X_MAX - 90, LCD_Y_MAX - 16, LCD_DRAW_SET);
|
||
|
|
else
|
||
|
|
GL_DrawMonoBitmap(ld, LCD_X_MAX - 106, LCD_Y_MAX - 16, LCD_DRAW_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void Test_Frequency(void)
|
||
|
|
{
|
||
|
|
if(freqArray[frequency].enabled)
|
||
|
|
Display_Frequency(frequency);
|
||
|
|
|
||
|
|
frequency = Next_Frequency(frequency);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Bye_Bye()
|
||
|
|
{
|
||
|
|
LCD_Clear();
|
||
|
|
Display_Splash();
|
||
|
|
// FL_DrawString("Bye Bye", 52, LCD_Y_MIN + 49 , font16Bold, LCD_DRAW_XOR, FL_ALIGN_LEFT);
|
||
|
|
LCD_Update();
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Danger_Menu()
|
||
|
|
{
|
||
|
|
static uint32_t count = 0;
|
||
|
|
|
||
|
|
if (count < 3)
|
||
|
|
{
|
||
|
|
count++;
|
||
|
|
// FL_DrawString("Extreme Voltage! ", 16, LCD_Y_MIN + 19 , font16Bold, LCD_DRAW_XOR, FL_ALIGN_LEFT);
|
||
|
|
GL_DrawMonoBitmap(dangerousVoltage68x60, LCD_X_MIN+88, LCD_Y_MIN+30, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
}
|
||
|
|
else
|
||
|
|
count = 0;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Estop(void)
|
||
|
|
{
|
||
|
|
static uint32_t count_msg_tmr = 0;
|
||
|
|
|
||
|
|
if(count_msg_tmr < 3)
|
||
|
|
{
|
||
|
|
FL_DrawString("Unsafe Voltage Detected !", 16, LCD_Y_MIN + 19 , font16Bold, LCD_DRAW_XOR, FL_ALIGN_LEFT);
|
||
|
|
count_msg_tmr++;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
else
|
||
|
|
{
|
||
|
|
FL_DrawString(" ", 32, 16, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
count_msg_tmr = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
void Display_Measurements(void)
|
||
|
|
{
|
||
|
|
Display_Volts();
|
||
|
|
Display_Current();
|
||
|
|
Display_Ohms();
|
||
|
|
Display_Watts();
|
||
|
|
}
|
||
|
|
void Display_Normal(void)
|
||
|
|
{
|
||
|
|
// Display_Measurements(); 3/11/24
|
||
|
|
|
||
|
|
if(Power_Level > 0)
|
||
|
|
Display_Currently_Selected();
|
||
|
|
|
||
|
|
Display_Battery();
|
||
|
|
|
||
|
|
Display_Mode(Cur_Mode);
|
||
|
|
|
||
|
|
Display_Wireless(0);
|
||
|
|
if(Cur_Mode == BROADCAST)
|
||
|
|
Display_Bcast();
|
||
|
|
else
|
||
|
|
Display_Level(Power_Level); // Display bars
|
||
|
|
|
||
|
|
Display_Frequency(frequency);
|
||
|
|
|
||
|
|
if(Test_Mode)
|
||
|
|
FL_DrawString("Test", LCD_X_MIN, LCD_Y_MIN, font16Bold, LCD_DRAW_XOR, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
}
|
||
|
|
void Display_Flash_Bat(void)
|
||
|
|
|
||
|
|
{
|
||
|
|
static uint32_t flash_count = 0;
|
||
|
|
|
||
|
|
if(flash_count < 3)
|
||
|
|
{
|
||
|
|
LCD_Clear(); //clear the frameBuffer
|
||
|
|
FL_DrawString("Low Battery", X_POS_MA+85, LCD_Y_MIN + 48 , font16Bold, LCD_DRAW_XOR, FL_ALIGN_CENTER);
|
||
|
|
flash_count++;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
// FL_DrawString(" ", 32, 16, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
LCD_Clear(); //clear the frameBuffer
|
||
|
|
flash_count = 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Bat_Error(void)
|
||
|
|
{
|
||
|
|
static uint32_t count_msg_tmr = 0;
|
||
|
|
|
||
|
|
if(count_msg_tmr < 3)
|
||
|
|
{
|
||
|
|
FL_DrawString("Battery Insertion Error!", 16, LCD_Y_MIN + 19 , font16Bold, LCD_DRAW_XOR, FL_ALIGN_LEFT);
|
||
|
|
count_msg_tmr++;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
FL_DrawString(" ", 16, LCD_Y_MIN +19, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
count_msg_tmr = 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
uint8_t Display_Taps(void)
|
||
|
|
{
|
||
|
|
uint8_t temp;
|
||
|
|
|
||
|
|
temp = Port_State[BOTTOM_SR] & 0b00011000; // preserve the taps
|
||
|
|
|
||
|
|
switch(temp)
|
||
|
|
{
|
||
|
|
case TAP1_LF_ON:
|
||
|
|
temp = 1;
|
||
|
|
break;
|
||
|
|
|
||
|
|
case TAP2_LF_ON:
|
||
|
|
temp = 2;
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case TAP3_LF_ON:
|
||
|
|
temp = 3;
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case TAP4_LF_ON:
|
||
|
|
temp = 4;
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
temp = 5;
|
||
|
|
}
|
||
|
|
return(temp);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void Display_Currently_Selected(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
switch (Cur_Mode)
|
||
|
|
{
|
||
|
|
|
||
|
|
case BROADCAST:
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT1_A:
|
||
|
|
if(ACCY_GetConnectedAccessory(1) == ID_CLAMP || ACCY_GetConnectedAccessory(1) == ID_CLAMP2)
|
||
|
|
//Display_Clamp_Volts();
|
||
|
|
Display_Clamp_Power();
|
||
|
|
else
|
||
|
|
Display_Line_Measurements();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT1_B:
|
||
|
|
if(ACCY_GetConnectedAccessory(1) == ID_CLAMP || ACCY_GetConnectedAccessory(1) == ID_CLAMP2)
|
||
|
|
//Display_Clamp_Volts();
|
||
|
|
Display_Clamp_Power();
|
||
|
|
else
|
||
|
|
Display_Line_Measurements();
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT2_A:
|
||
|
|
if(ACCY_GetConnectedAccessory(2) == ID_CLAMP || ACCY_GetConnectedAccessory(2) == ID_CLAMP2)
|
||
|
|
//Display_Clamp_Volts();
|
||
|
|
Display_Clamp_Power();
|
||
|
|
else
|
||
|
|
Display_Line_Measurements();
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
case PORT2_B:
|
||
|
|
if(ACCY_GetConnectedAccessory(2) == ID_CLAMP || ACCY_GetConnectedAccessory(2) == ID_CLAMP2)
|
||
|
|
//Display_Clamp_Volts();
|
||
|
|
Display_Clamp_Power();
|
||
|
|
else
|
||
|
|
Display_Line_Measurements();
|
||
|
|
|
||
|
|
break;
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Line_Measurements(void)
|
||
|
|
{
|
||
|
|
Display_Line_Voltage();
|
||
|
|
Display_Line_Current();
|
||
|
|
Display_Line_Ohms();
|
||
|
|
Display_Line_Watts();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void Display_Tx_Status(void)
|
||
|
|
{
|
||
|
|
|
||
|
|
switch(Task)
|
||
|
|
{
|
||
|
|
case SAFETY_TASK:
|
||
|
|
Display_Danger_Menu();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case FATAL_ERROR_TASK:
|
||
|
|
Display_Fatal_Error();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case ESTOP_TASK:
|
||
|
|
Display_Estop();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case LOW_BATTERY_TASK:
|
||
|
|
Display_Flash_Bat();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case BAT_INSERTION_ERROR:
|
||
|
|
LCD_Clear(); //clear the frameBuffer
|
||
|
|
Display_Bat_Error();
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
Display_Normal();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_USB_Status(void)
|
||
|
|
{
|
||
|
|
if(GPIO_PinRead(GPIO,1,6))
|
||
|
|
Display_USB();
|
||
|
|
// GL_DrawMonoBitmap(usbIconSmall, LCD_X_MID, 30, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Over_Voltage_Status(void)
|
||
|
|
{
|
||
|
|
static uint32_t county = 0;
|
||
|
|
|
||
|
|
if(Over_Voltage_Flag)
|
||
|
|
{
|
||
|
|
if(county<3)
|
||
|
|
{
|
||
|
|
county++;
|
||
|
|
Display_High_Voltage(); // TODO Display correct graphic once agreed
|
||
|
|
}
|
||
|
|
else
|
||
|
|
county = 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_Fatal_Error(void)
|
||
|
|
{
|
||
|
|
sprintf(tempString,"Error %d", Error);
|
||
|
|
FL_DrawString(tempString, 80, 90, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Display_OnScreen_Diagnostics(void)
|
||
|
|
{
|
||
|
|
sprintf(tempString, "POT %d", Dds_Pot_Val[1]);
|
||
|
|
FL_DrawString(tempString, 0, 30, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
if((Port_State[MID_SR] & 0x40) > 0)
|
||
|
|
sprintf(tempString, "HI", Dds_Pot_Val[1]);
|
||
|
|
else
|
||
|
|
sprintf(tempString, "LO");
|
||
|
|
|
||
|
|
FL_DrawString(tempString, 0, 50, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
if(hwf.vBattCap_021)
|
||
|
|
sprintf(tempString, "CF");
|
||
|
|
else
|
||
|
|
sprintf(tempString, "CNF");
|
||
|
|
FL_DrawString(tempString, 0, 0, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
|
||
|
|
sprintf(tempString,"Taps %d", Display_Taps());
|
||
|
|
FL_DrawString(tempString, 0, 20, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
sprintf(tempString,"B %.2fV",adc.V_BAT);
|
||
|
|
FL_DrawString(tempString, 0, 60, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
// sprintf(tempString,"VPSU %.2fV", adc.V_PSU);
|
||
|
|
// FL_DrawString(tempString, 0, 80, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
sprintf(tempString,"C %.2fV",adc.V_CHK);
|
||
|
|
FL_DrawString(tempString, 0, 70, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
|
||
|
|
// sprintf(tempString,"Time: %d", systemTime);
|
||
|
|
// FL_DrawString(tempString, 0, 80, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
//if (clampData.slope > 0)
|
||
|
|
{
|
||
|
|
float t = sqrtf(clampData.impedance * 10.0f);
|
||
|
|
|
||
|
|
//sprintf(tempString,"Vmax: %f", t);
|
||
|
|
sprintf(tempString,"Target: %f", clampData.targetPower);
|
||
|
|
FL_DrawString(tempString, 0, 80, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
}
|
||
|
|
|
||
|
|
// sprintf(tempString,"R %.2f",adc.IRawFilt);
|
||
|
|
// FL_DrawString(tempString, 0, 80, font10Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//if(GPIO_PinRead(GPIO,1,6))
|
||
|
|
// GL_DrawMonoBitmap(usbIconSmall, LCD_X_MID, 30, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// if (countx >= 25)
|
||
|
|
// countx = 0;
|
||
|
|
// else
|
||
|
|
// countx++;
|
||
|
|
//
|
||
|
|
// if (!GPIO_PinRead(GPIO, 0, 31))
|
||
|
|
// {
|
||
|
|
// FL_DrawString("Key0", 12, 80, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
// }
|
||
|
|
|
||
|
|
|
||
|
|
// tunaX += tunaXStep;
|
||
|
|
// if(tunaX > tunaXMax)
|
||
|
|
// {
|
||
|
|
// tunaX = 0;
|
||
|
|
// }
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// char a[] = "29KHz";
|
||
|
|
// char *ptr1 = a;
|
||
|
|
|
||
|
|
// char *frqptr[26] = {" 98Hz","128Hz","263Hz","440Hz","512Hz","560Hz","577Hz","640Hz","815Hz","870Hz",
|
||
|
|
// "940Hz","1.02KHz","1.17KHz","3.14KHz","4.09KHz","6.00KHz","8.01KHz","9.82KHz","29.4KHz",
|
||
|
|
// "32.7KHz","44.6KHz","65.5KHz","83.0KHz","131KHz","200KHz","480KHz"};
|
||
|
|
|
||
|
|
|
||
|
|
// GL_DrawLine(1, 1, 33, 33, 3, LCD_DRAW_SET);
|
||
|
|
// GL_DrawFilledRectangle(160, 0, 200, 40, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// FL_DrawString("Over Voltage!", tunaX, 80, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
// GL_DrawMonoBitmap(anchor, 160, 20, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// GL_DrawFilledRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, LCD_DRAW_XOR);
|
||
|
|
|
||
|
|
// GL_DrawRectangle(00, LCD_Y_MAX-40, 40, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
// GL_DrawRectangle(50, LCD_Y_MAX-30, 80, LCD_Y_MAX, 1, LCD_DRAW_SET);
|
||
|
|
|
||
|
|
// FL_DrawString("8 KHz", LCD_X_MAX, LCD_Y_MAX - FL_GetFontHeight(font18Bold), font18Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
//# FL_DrawString( ptr1, LCD_X_MAX, LCD_Y_MAX - FL_GetFontHeight(font18Bold), font18Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
// FL_DrawString( frqptr[countx], LCD_X_MAX, LCD_Y_MAX - FL_GetFontHeight(font18Bold), font18Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
// FL_DrawString( frqptr[countx], LCD_X_MAX, LCD_Y_MAX - 22, font18Bold, LCD_DRAW_SET, FL_ALIGN_RIGHT);
|
||
|
|
// GL_DrawRectangle(0, 0, LCD_X_MAX, LCD_Y_MAX, 1, LCD_DRAW_SET); // Outer Border
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// sprintf(tempString, "1: %.2f", adc.V_ID1);
|
||
|
|
// FL_DrawString( tempString, 0, 0, font12Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
// sprintf(tempString, "2: %.2f", adc.V_ID2);
|
||
|
|
// FL_DrawString( tempString, 0, 15, font12Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
// sprintf(tempString, "%d", Power_Level); // Display number
|
||
|
|
// FL_DrawString(tempString, 120, 00, font18Bold, LCD_DRAW_SET, FL_ALIGN_LEFT);
|
||
|
|
|
||
|
|
// Display_Backlight(1);
|
||
|
|
//SetBacklightPower(1);
|
||
|
|
|
||
|
|
|