Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
display
Browse files Browse the repository at this point in the history
  • Loading branch information
nfxbeats committed Dec 31, 2021
1 parent 5033a3d commit f172623
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 7 deletions.
20 changes: 13 additions & 7 deletions device_nfxTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import mixer
import general


from fireNFX_Defs import *
from fireNFX_PadDefs import *
from fireNFX_Utils import *
from fireNFX_Display import *

_ShiftHeld = False
_AltHeld = False
Expand Down Expand Up @@ -80,6 +82,10 @@ def OnInit():
RefreshTransport()
RefreshShiftAlt()

InitDisplay()
DisplayText(Font6x16 , JustifyLeft, 0, "HELLO", True)


def ResetBeatIndicators():
for i in range(0, len(BeatIndicators) ):
SendCC(BeatIndicators[i], SingleColorOff)
Expand Down Expand Up @@ -286,13 +292,13 @@ def HandleKnob(event, ctrlID):


def HandleKnobReal(recEventIDIndex, value, Name, Bipolar):
knobres = 1/48
print('HandleKnobReaL', recEventIDIndex, value, REC_MIDIController, 0, Bipolar, knobres)
# mixer.automateEvent(recEventIDIndex, value, REC_MIDIController, 0, Bipolar, knobres)
general.processRECEvent(recEventIDIndex, value, REC_MIDIController)

# barVal = device.getLinkedValue(ID)
# fire.DisplayBar(Name, barVal, Bipolar)
knobres = 1/64
currVal = device.getLinkedValue(recEventIDIndex)
#print('HandleKnobReal', Name, value, recEventIDIndex, Bipolar, currVal, knobres)
#general.processRECEvent(recEventIDIndex, value, REC_MIDIController)
mixer.automateEvent(recEventIDIndex, value, REC_MIDIController, 0, 1, knobres)
currVal = device.getLinkedValue(recEventIDIndex)
DisplayBar(Name, currVal, Bipolar)
return True

def HandlePage(event, ctrlID):
Expand Down
5 changes: 5 additions & 0 deletions fireNFX_Defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

USER_MODE = UM_CHANNEL

#Fire specific
ManufacturerIDConst = 0x47
DeviceIDBroadCastConst = 0x7F
ProductIDConst = 0x43

# Message IDs (from PC to device)
MsgIDGetAllButtonStates = 0x40
MsgIDGetPowerOnButtonStates = 0x41
Expand Down
82 changes: 82 additions & 0 deletions fireNFX_Display.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import screen # this is for the FIRE display and is undocumented
from midi import *
from fireNFX_Defs import *


DisplayWidth = 128
DisplayHeight = 64
# Text settings
Font6x8 = 0
Font6x16 = 1
Font10x16 = 2
Font12x32 = 3
JustifyLeft = 0
JustifyCenter = 1
JustifyRight = 2
ScreenDisplayDelay = 2 # delay (in ms) required to access the screen (seems slow)

TextScrollPause = 10
TextScrollSpeed = 2
TextDisplayTime = 4000

TimedTextRow = 1
FPSRow = 3
FireFontSize = 16
TextOffset = -4
TextRowHeight = 20

Idle_Interval = 100
Idle_Interval_Max = 8

ScreenActiveTimeout = 30 # seconds to keep screen active (screen has its own timeout which will kick in after this)
ScreenAutoTimeout = 10

tlNone = 1
tlText = 1 << 1
tlBar = 1 << 2
tlMeter = 1 << 3


def ClearDisplay():
screen.fillRect(0, 0, DisplayWidth, DisplayHeight, 0x000000)
screen.update()

def DisplayText(Font, Justification, PageTop, Text, CheckIfSame, DisplayTime = 0):
screen.displayText(Font, Justification, PageTop, Text, CheckIfSame, DisplayTime)

def DisplayBar(Text, Value, Bipolar):
screen.displayBar(0, TextRowHeight * TimedTextRow, Text, Value, Bipolar)

def DisplayTimedText(Text):
screen.displayTimedText(Text, TimedTextRow)

def InitDisplay():
screen.init(DisplayWidth, DisplayHeight, TextRowHeight, FireFontSize, 0xFFFFFF, 0)
sysexHeader = int.from_bytes(bytes([MIDI_BEGINSYSEX, ManufacturerIDConst, DeviceIDBroadCastConst ,ProductIDConst, MsgIDSendPackedOLEDData]), byteorder='little')
screen.setup(sysexHeader, ScreenActiveTimeout, ScreenAutoTimeout, TextScrollPause, TextScrollSpeed, TextDisplayTime)
screen.fillRect(0, 0, DisplayWidth, DisplayHeight, 0)
print('x')

def DeInitDisplay():
screen.deInit()





#snippets

#i = screen.findTextLine(0, 20, 128, 20 + 44)
#if (general.getVersion() > 8):
# if (i >= 0):
# screen.removeTextLine(i, 1)
# if mode in [ScreenModePeak, ScreenModeScope]:
# screen.addMeter(mode, 0, 20, 128, 20 + 44)

#screen.init(self.DisplayWidth, self.DisplayHeight, TextRowHeight, FireFontSize, 0xFFFFFF, 0)
#sysexHeader = int.from_bytes(bytes([MIDI_BEGINSYSEX, ManufacturerIDConst, DeviceIDBroadCastConst ,ProductIDConst, MsgIDSendPackedOLEDData]), byteorder='little')
#screen.setup(sysexHeader, ScreenActiveTimeout, ScreenAutoTimeout, TextScrollPause, TextScrollSpeed, TextDisplayTime)
#self.BgCol = 0x000000
#self.FgCol = 0xFFFFFF
#self.DiCol = 0xFFFFFF
#screen.fillRect(0, 0, self.DisplayWidth, self.DisplayHeight, 0)

0 comments on commit f172623

Please sign in to comment.