diff --git a/device_nfxTest.py b/device_nfxTest.py index 0f8fc9b..61f5779 100644 --- a/device_nfxTest.py +++ b/device_nfxTest.py @@ -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 @@ -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) @@ -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): diff --git a/fireNFX_Defs.py b/fireNFX_Defs.py index f25cb97..2142383 100644 --- a/fireNFX_Defs.py +++ b/fireNFX_Defs.py @@ -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 diff --git a/fireNFX_Display.py b/fireNFX_Display.py new file mode 100644 index 0000000..ae4c9a1 --- /dev/null +++ b/fireNFX_Display.py @@ -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)