Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 29 additions & 35 deletions opendps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ COMMANDLINE := 0
BAUDRATE ?= 9600

# Set build model, defaults to DPS5005
MODEL := DPS5005
MODEL := DPS5020

BINARY = opendps_$(MODEL)

# Include splash screen
SPLASH_SCREEN := 0
SPLASH_SCREEN := 1

# Include support for thermal lockout via the serial interface
THERMAL_LOCKOUT := 0

# Build wifi version (only change being that the wifi icon will start flashing
# on power up)
WIFI := 1
WIFI := 0

# Maximum current your DPS model can provide. Eg 5000mA for the DPS5005
# This is usually set by MODEL but you can override it here
Expand All @@ -34,29 +34,29 @@ WDOG ?= 1
METER_FONT_FILE ?= gfx/Ubuntu-C.ttf
METER_FONT_SMALL_SIZE ?= 18
METER_FONT_MEDIUM_SIZE ?= 24
METER_FONT_LARGE_SIZE ?= 48
METER_FONT_LARGE_SIZE ?= 40
FULL_FONT_FILE ?= gfx/ProggyClean.ttf
FULL_FONT_SMALL_SIZE ?= 16

# Color space for the DPS display. Most units use GBR but RGB has been spotted in the wild
COLORSPACE ?= 0

# Colors for the main UI elements -- see ili9163c.h for list of colors
COLOR_VOLTAGE ?= WHITE
COLOR_AMPERAGE ?= WHITE
COLOR_VOLTAGE ?= 0x87F0
COLOR_AMPERAGE ?= 0xFFF0
COLOR_WATTAGE ?= 0xC41F
COLOR_INPUT ?= WHITE

# Optional tinting for UI elements
TINT ?= ffffff

# Enable CC mode
CC_ENABLE ?= 1
# Enable CC/CV mode
CCCV_ENABLE ?= 1

# Enable CV mode
CV_ENABLE ?= 1

# Enable cl mode
CL_ENABLE ?= 1
# Enable MPPT mode (Solar panel Maximum Power Point Tracking)
# WARNING: This screen automatically enables the output and ramps up to maximum current.
# Make sure you set the Voltage and Current limits before connecting a load!
MPPT_ENABLE ?= 1

# Enable function generator mode
FUNCGEN_ENABLE ?= 1
Expand All @@ -65,7 +65,7 @@ FUNCGEN_ENABLE ?= 1
INVERT_ENABLE ?= 0

# Power buttons in color
POWER_COLORED ?= 1
POWER_COLORED ?= 0

# Power off button visible
POWER_OFF_VISIBLE ?= 0
Expand All @@ -82,6 +82,7 @@ CFLAGS += \
-DCOLORSPACE=$(COLORSPACE) \
-DCOLOR_VOLTAGE=$(COLOR_VOLTAGE) \
-DCOLOR_AMPERAGE=$(COLOR_AMPERAGE) \
-DCOLOR_WATTAGE=$(COLOR_WATTAGE) \
-DCOLOR_INPUT=$(COLOR_INPUT) \
-D$(MODEL)

Expand Down Expand Up @@ -110,10 +111,7 @@ OBJS = \
font-meter_small.o \
font-meter_medium.o \
font-meter_large.o \
gfx-cc.o \
gfx-crosshair.o \
gfx-cv.o \
gfx-cl.o \
gfx-padlock.o \
gfx-thermometer.o \
gfx-wifi.o \
Expand All @@ -124,16 +122,17 @@ ifdef MAX_CURRENT
endif

ifeq ($(DEBUG),1)
CFLAGS +=-DCONFIG_DEBUG
CFLAGS +=-DCONFIG_DEBUG -g -O1
OBJS += dbg_printf.o
else
CFLAGS +=-DCONFIG_RELEASE -g -Os
endif

ifeq ($(WDOG),1)
CFLAGS +=-DCONFIG_WDOG
OBJS += wdog.o
endif


ifeq ($(INVERT_ENABLE),1)
CFLAGS +=-DCONFIG_INVERT_ENABLE
endif
Expand All @@ -149,19 +148,14 @@ ifeq ($(POWER_OFF_VISIBLE),1)
CFLAGS +=-DCONFIG_POWER_OFF_VISIBLE
endif

ifeq ($(CC_ENABLE),1)
CFLAGS +=-DCONFIG_CC_ENABLE
OBJS += func_cc.o
endif

ifeq ($(CV_ENABLE),1)
CFLAGS +=-DCONFIG_CV_ENABLE
OBJS += func_cv.o
ifeq ($(CCCV_ENABLE),1)
CFLAGS +=-DCONFIG_CCCV_ENABLE
OBJS += func_cccv.o gfx-cccv.o
endif

ifeq ($(CL_ENABLE),1)
CFLAGS +=-DCONFIG_CL_ENABLE
OBJS += func_cl.o
ifeq ($(MPPT_ENABLE),1)
CFLAGS +=-DCONFIG_MPPT_ENABLE
OBJS += func_mppt.o gfx-mppt.o
endif

ifeq ($(FUNCGEN_ENABLE),1)
Expand Down Expand Up @@ -192,11 +186,11 @@ endif
include ../libopencm3.target.mk

fonts:
@python ./gen_lookup.py -l -o gfx_lookup
@python ./gen_lookup.py -f $(FULL_FONT_FILE) -s $(FULL_FONT_SMALL_SIZE) -o full_small -a
@python ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_SMALL_SIZE) -o meter_small
@python ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_MEDIUM_SIZE) -o meter_medium
@python ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_LARGE_SIZE) -o meter_large
@python2 ./gen_lookup.py -l -o gfx_lookup
@python2 ./gen_lookup.py -f $(FULL_FONT_FILE) -s $(FULL_FONT_SMALL_SIZE) -o full_small -a
@python2 ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_SMALL_SIZE) -o meter_small
@python2 ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_MEDIUM_SIZE) -o meter_medium
@python2 ./gen_lookup.py -f $(METER_FONT_FILE) -s $(METER_FONT_LARGE_SIZE) -o meter_large

test:
@make -C tests
Expand Down
20 changes: 10 additions & 10 deletions opendps/dps-model.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@
/** Contribution by @cleverfox */
#if defined(DPS5020)
#ifndef CONFIG_DPS_MAX_CURRENT
#define CONFIG_DPS_MAX_CURRENT (20000) // Please note that the UI currently does not handle settings larger that 9.99A
#define CONFIG_DPS_MAX_CURRENT (20000)
#endif
#define CURRENT_DIGITS 2
#define CURRENT_DECIMALS 2
#define ADC_CHA_IOUT_GOLDEN_VALUE (59)
#define A_ADC_K (float)6.75449f
#define A_ADC_C (float)-358.73f
#define A_DAC_K (float)0.16587f
#define A_DAC_C (float)243.793f
#define V_ADC_K (float)13.2930f
#define V_ADC_C (float)-179.91f
#define V_DAC_K (float)0.07528f
#define V_DAC_C (float)6.68949f
#define A_ADC_K (float)6.810f
#define A_ADC_C (float)-397.0f
#define A_DAC_K (float)0.1655f
#define A_DAC_C (float)273.0f
#define V_ADC_K (float)13.01f
#define V_ADC_C (float)-171.0f
#define V_DAC_K (float)0.077f
#define V_DAC_C (float)5.09f

#define VIN_ADC_K (float)16.956f
#define VIN_ADC_C (float)6.6895f
Expand Down Expand Up @@ -150,6 +150,6 @@
#define VIN_ADC_C (float)64.112f
#endif

#define VIN_VOUT_RATIO (float)1.1f /** (Vin / VIN_VOUT_RATIO) = Max Vout */
#define VIN_VOUT_RATIO (float)1.1f /** (Vin / VIN_VOUT_RATIO) = Max Vout (or Min Vin) */

#endif // __DPS_MODEL_H__
Loading