Skip to content
Snippets Groups Projects
Commit 1edfe185 authored by RobertPatzke's avatar RobertPatzke
Browse files

Update 20221121

parent f3a997e7
No related branches found
No related tags found
1 merge request!8Update Dev
//-----------------------------------------------------------------------------
// Thema: Social Manufacturing Network / Development Environment
// Datei: MeasMuse.cpp
// Editor: Robert Patzke
// URI/URL: www.mfp-portal.de
// Datum: 14. November 2022
//-----------------------------------------------------------------------------
// Lizenz: CC-BY-SA (siehe Wikipedia: Creative Commons)
//
#include "MeasMuse.h"
// ----------------------------------------------------------------------------
// Konstruktoren und Initialisierungen
// ----------------------------------------------------------------------------
//
MeasMuse::MeasMuse()
{
}
// ----------------------------------------------------------------------------
// Hilfsfunktionen
// ----------------------------------------------------------------------------
//
void MeasMuse::Posture2Midi::setKoeffRoll(MeasMap map)
{
switch(map)
{
case BiLinear:
koeffRoll = (midiArea[aimRoll].high - midiArea[aimRoll].low)
/ (borderHighRoll - borderLowRoll);
midiArea[aimRoll].offset = midiArea[aimRoll].low - (byte) koeffRoll * borderLowRoll;
break;
default:
break;
}
}
void MeasMuse::Posture2Midi::setKoeffPitch(MeasMap map)
{
switch(map)
{
case BiLinear:
koeffPitch = (midiArea[aimPitch].high - midiArea[aimPitch].low)
/ (borderHighPitch - borderLowPitch);
midiArea[aimPitch].offset = midiArea[aimPitch].low - (byte) koeffPitch * borderLowPitch;
break;
default:
break;
}
}
void MeasMuse::Posture2Midi::setKoeffYaw(MeasMap map)
{
switch(map)
{
case BiLinear:
koeffYaw = (midiArea[aimYaw].high - midiArea[aimYaw].low)
/ (borderHighYaw - borderLowYaw);
midiArea[aimYaw].offset = midiArea[aimYaw].low - (byte) koeffYaw * borderLowYaw;
break;
default:
break;
}
}
int MeasMuse::Posture2Midi::getResultRoll(MidiResultPtr refResult, float measValue)
{
float inVal = measValue + offsetRoll;
#ifdef MeasMuseDebug
debInValRoll = inVal;
#endif
if(inVal < borderLowRoll) return(-1);
if(inVal > borderHighRoll) return(1);
byte value = midiArea[aimRoll].offset + (byte) (koeffRoll * inVal);
if(refResult->value != value)
{
refResult->value = value;
refResult->newVal = true;
}
refResult->type = aimRoll;
#ifdef MeasMuseDebug
debResVal = value;
#endif
return(0);
}
int MeasMuse::Posture2Midi::getResultPitch(MidiResultPtr refResult, float measValue)
{
float inVal = measValue + offsetPitch;
if(inVal < borderLowPitch) return(-1);
if(inVal > borderHighPitch) return(1);
byte value = midiArea[aimPitch].offset + (byte) (koeffPitch * inVal);
if(refResult->value != value)
{
refResult->value = value;
refResult->newVal = true;
}
refResult->type = aimPitch;
return(0);
}
int MeasMuse::Posture2Midi::getResultYaw(MidiResultPtr refResult, float measValue)
{
float inVal = measValue + offsetYaw;
if(inVal < borderLowYaw) return(-1);
if(inVal > borderHighYaw) return(1);
byte value = midiArea[aimYaw].offset + (byte) (koeffYaw * inVal);
if(refResult->value != value)
{
refResult->value = value;
refResult->newVal = true;
}
refResult->type = aimYaw;
return(0);
}
// ----------------------------------------------------------------------------
// Konfiguration
// ----------------------------------------------------------------------------
//
void MeasMuse::setRollArea(int channel, float offset, float min, float max)
{
config[channel].offsetRoll = offset;
config[channel].borderLowRoll = min;
config[channel].borderHighRoll = max;
}
void MeasMuse::setPitchArea(int channel, float offset, float min, float max)
{
config[channel].offsetPitch = offset;
config[channel].borderLowPitch = min;
config[channel].borderHighPitch = max;
}
void MeasMuse::setYawArea(int channel, float offset, float min, float max)
{
config[channel].offsetYaw = offset;
config[channel].borderLowYaw = min;
config[channel].borderHighYaw = max;
}
void MeasMuse::setAims(int channel, Meas2Midi aimRoll, Meas2Midi aimPitch, Meas2Midi aimYaw)
{
config[channel].aimRoll = aimRoll;
config[channel].aimPitch = aimPitch;
config[channel].aimYaw = aimYaw;
}
void MeasMuse::setMidiArea(int channel, Meas2Midi midi, byte low, byte high)
{
config[channel].midiArea[midi].low = low;
config[channel].midiArea[midi].high = high;
}
void MeasMuse::setMapping(int channel, MeasMap mapRoll, MeasMap mapPitch, MeasMap mapYaw)
{
config[channel].setKoeffRoll(mapRoll);
config[channel].setKoeffPitch(mapPitch);
config[channel].setKoeffYaw(mapYaw);
}
// ----------------------------------------------------------------------------
// Anwenderfunktionen
// ----------------------------------------------------------------------------
//
int MeasMuse::resultRoll(int channel, MidiResultPtr refResult, float measValue)
{
return(config[channel].getResultRoll(refResult, measValue));
}
int MeasMuse::resultPitch(int channel, MidiResultPtr refResult, float measValue)
{
return(config[channel].getResultPitch(refResult, measValue));
}
int MeasMuse::resultYaw(int channel, MidiResultPtr refResult, float measValue)
{
return(config[channel].getResultYaw(refResult, measValue));
}
//-----------------------------------------------------------------------------
// Thema: Social Manufacturing Network / Development Environment
// Datei: MeasMuse.h
// Editor: Robert Patzke
// URI/URL: www.mfp-portal.de
// Datum: 14. November 2022
//-----------------------------------------------------------------------------
// Lizenz: CC-BY-SA (siehe Wikipedia: Creative Commons)
//
#ifndef _MeasMuse_h
#define _MeasMuse_h
//-----------------------------------------------------------------------------
#include "arduinoDefs.h"
//#define MeasMuseDebug
#define NrOfChannelsMM 16
// ----------------------------------------------------------------------------
// Datentypen
// ----------------------------------------------------------------------------
//
typedef struct _Value2Midi
{
short borderLowAz;
short borderHighAz;
short borderLowAy;
short borderHighAy;
short borderLowAx;
short borderHighAx;
byte lowNote;
byte highNote;
} Value2Midi, *Value2MidiPtr;
enum Meas2Midi
{
Nothing, // keine Zielzuweisung
NoteType, // Zuweisung Notentyp (Länge)
NoteVal, // Zuweisung Notenwert (Höhe)
NoteVel, // Zuweisung Anschagstärke
NrM2M // Anzahl für Array
};
enum MeasMap
{
OneToOne, // Direkte Wertübertragung
BiLinear, // Linear auf Linear
NrMM
};
typedef struct _MidiResult
{
Meas2Midi type;
byte value;
bool newVal;
} MidiResult, *MidiResultPtr;
typedef struct _MidiArea
{
byte low;
byte high;
byte offset;
} MidiArea, *MidiAreaPtr;
// ---------------------------------------------------------------------------
// class MeasMuse
// ---------------------------------------------------------------------------
// Abbildung von Messwerten auf musikalische und andere künstlerische
// Umgebung inklusive der Konfiguration
class MeasMuse
{
// -------------------------------------------------------------------------
// class Posture2Midi, eingebettet
// -------------------------------------------------------------------------
// Details der Konfiguration für einen Kanal
//
public:
class Posture2Midi
{
public:
// Konfigurationsdaten
// -----------------------------------------------------------------------
float offsetRoll;
float borderLowRoll;
float borderHighRoll;
float koeffRoll;
float offsetPitch;
float borderLowPitch;
float borderHighPitch;
float koeffPitch;
float offsetYaw;
float borderLowYaw;
float borderHighYaw;
float koeffYaw;
Meas2Midi aimRoll;
Meas2Midi aimPitch;
Meas2Midi aimYaw;
byte signAreaValue[4];
byte signAreaCtrl[4];
MidiArea midiArea[NrM2M];
// Hilfsfunktionen
// -----------------------------------------------------------------------
//
public:
void setKoeffRoll(MeasMap map);
void setKoeffPitch(MeasMap map);
void setKoeffYaw(MeasMap map);
int getResultRoll(MidiResultPtr refResult, float measValue);
int getResultPitch(MidiResultPtr refResult, float measValue);
int getResultYaw(MidiResultPtr refResult, float measValue);
#ifdef MeasMuseDebug
// Debugging
// -----------------------------------------------------------------------
//
float debInValRoll;
byte debResVal;
#endif
};
public:
// -------------------------------------------------------------------------
// globale klassenspezifische Datentypen
// -------------------------------------------------------------------------
//
private:
// -------------------------------------------------------------------------
// lokale Datentypen
// -------------------------------------------------------------------------
//
// -------------------------------------------------------------------------
// Hilfsfunktionen
// -------------------------------------------------------------------------
//
private:
#ifdef MeasMuseDebug
public:
#endif
// -------------------------------------------------------------------------
// lokale Variablen
// -------------------------------------------------------------------------
//
Posture2Midi config[NrOfChannelsMM]; // Konfiguration der Abbildung
public:
// -------------------------------------------------------------------------
// Konstruktoren und Initialisierungen
// -------------------------------------------------------------------------
//
MeasMuse();
// -------------------------------------------------------------------------
// Konfiguration
// -------------------------------------------------------------------------
//
void setRollArea(int channel, float offset, float min, float max);
void setPitchArea(int channel, float offset, float min, float max);
void setYawArea(int channel, float offset, float min, float max);
void setAims(int channel, Meas2Midi aimRoll, Meas2Midi aimPitch, Meas2Midi aimYaw);
void setMidiArea(int channel, Meas2Midi midi, byte low, byte high);
void setMapping(int channel, MeasMap mapRoll, MeasMap mapPitch, MeasMap mapYaw);
// -------------------------------------------------------------------------
// Anwenderfunktionen
// -------------------------------------------------------------------------
//
int resultRoll(int channel, MidiResultPtr refResult, float measValue);
int resultPitch(int channel, MidiResultPtr refResult, float measValue);
int resultYaw(int channel, MidiResultPtr refResult, float measValue);
};
//-----------------------------------------------------------------------------
#endif // _MeasMuse_h
......@@ -33,64 +33,12 @@
#include "StateMachine.h"
#include "nRF52840Radio.h"
#include "MidiNotes.h"
#include "MeasMuse.h"
#include "BlePoll.h"
#include "ComRingBuf.h"
#include "nRF52840Ser.h"
#include "Monitor.h"
// ----------------------------------------------------------------------------
// Datentypen
// ----------------------------------------------------------------------------
//
typedef struct _Value2Midi
{
short borderLowAz;
short borderHighAz;
short borderLowAy;
short borderHighAy;
short borderLowAx;
short borderHighAx;
byte lowNote;
byte highNote;
} Value2Midi, *Value2MidiPtr;
enum Meas2Midi
{
NoteType,
NoteVal,
NoteVel
};
typedef struct _MidiBorders
{
byte low;
byte high;
} MidiBorders, *MiniBordersPtr;
typedef struct _Posture2Midi
{
float offsetRoll;
float borderLowRoll;
float borderHighRoll;
float koeffRoll;
float offsetPitch;
float borderLowPitch;
float borderHighPitch;
float koeffPitch;
float offsetYaw;
float borderLowYaw;
float borderHighYaw;
float koeffYaw;
Meas2Midi aimRoll;
Meas2Midi aimPitch;
Meas2Midi aimYaw;
byte signAreaValue[4];
byte signAreaCtrl[4];
MidiBorders midiBords[3];
} Posture2Midi, *Posture2MidiPtr;
// ----------------------------------------------------------------------------
// Vorwärtsreferenzen
// ----------------------------------------------------------------------------
......@@ -106,8 +54,7 @@ void apTestController();
void setParM1();
void setParM2();
void setParP1();
void setParP2();
void setParP1(int chn);
#ifdef DebugTerminal
......
......@@ -61,10 +61,12 @@ BlePoll blePoll((IntrfRadio *) &bleCom, micros);
// festgelegt werden.
Value2Midi val2midArr[NrOfSlavesToPoll + 1];
Posture2Midi post2midArr[NrOfSlavesToPoll + 1];
// Jeder Slave bekommt spezifische Value->Midi-Parameter.
// Index 0 steht für eventuelle Parameter des Masters
MeasMuse muse;
// Ab atSOAAP2 werden die Konfigurationen in einer eigenen Klasse verwaltet
SerParams ttyParams;
// ----------------------------------------------------------------------------
nRF52840Ser tty;
......@@ -132,6 +134,16 @@ char *infoThis =
"c5 Meldung an Slave senden\r\n"
};
// Startmeldung (Version und drehender Strich)
//
char *StartMsg =
{
"%@BleMidiMaster, Version 20221117 "
};
char runView[4] = {'|','/','-','\\'};
int runViewIdx = 0;
Monitor mon(modeEcho | modeNl,0,&lc);
// Eine statische Instanz (mit Konstruktordaten) der Klasse Monitor
......@@ -160,7 +172,8 @@ void setup()
bleCom.begin(); // Initialisierung der Datenübertragung
//bleCom.setPower(0x08); // Maximale Sendeleistung bei nRF52840
// TEST
bleCom.setPower(0x0FC); // Reduzierte Sendeleistung beim Schreibtisch-Test
//bleCom.setPower(0x0FC); // Reduzierte Sendeleistung beim Schreibtisch-Test
bleCom.setPower(0x000); // Standard-Sendeleistung BLE
//appType = BlePoll::atDevSOAAP;
appType = BlePoll::atSOAAP2;
......@@ -219,12 +232,12 @@ void setup()
// für die Übergabe zu sendender Zeichen
setParM1();
setParP1();
setParP1(1);
midi1.begin(120, nd32, MidiCycle, (IntrfBuf *) &crb);
midi1.setChannel(1);
setParM2();
setParP2();
setParP1(2);
midi2.begin(120, nd32, MidiCycle, (IntrfBuf *) &crb);
midi2.setChannel(2);
//midi2.stop();
......@@ -266,13 +279,18 @@ void loop()
}
#ifdef DebugTerminal
// Jede Sekunde erfolgt die Ausgabe einer Versionsmeldung
// Jede halbe Sekunde erfolgt die Ausgabe einer Versionsmeldung
// das kann über c0 am Terminal abgeschaltet werden
//
if(lc.timerMilli(lcTimer3, 1000, 0))
if(lc.timerMilli(lcTimer3, 500, 0))
{
if(!mon.cFlag[0])
mon.printcr((char *)"%@TestBleMidiMaster, Version 20221018");
{
mon.print(StartMsg);
mon.cprintcr(runView[runViewIdx]);
runViewIdx++;
if(runViewIdx > 3) runViewIdx = 0;
}
}
// Die Zeichen %@ am Anfang steuern die Ausgabe bei AndroidMonTerm in ein
// Textfeld (Label) statt auf das Terminal-Display
......@@ -289,6 +307,46 @@ void loop()
lc.end(); // Muss vor dem Ende von LOOP aufgerufen werden
}
// ----------------------------------------------------------------------------
// Daten auf Midi-Noten abbilden
//
void setParM1()
{
val2midArr[1].borderLowAz = 100;
val2midArr[1].borderHighAz = 8000;
val2midArr[1].borderLowAy = 100;
val2midArr[1].borderHighAy = 8300;
val2midArr[1].borderLowAx = 100;
val2midArr[1].borderHighAx = 4000;
val2midArr[1].lowNote = 23;
val2midArr[1].highNote = 96;
}
void setParM2()
{
val2midArr[2].borderLowAz = 100;
val2midArr[2].borderHighAz = 8000;
val2midArr[2].borderLowAy = 100;
val2midArr[2].borderHighAy = 8300;
val2midArr[2].borderLowAx = 100;
val2midArr[2].borderHighAx = 4000;
val2midArr[2].lowNote = 23;
val2midArr[2].highNote = 96;
}
void setParP1(int chn)
{
muse.setRollArea(chn, 90, 45, 170);
muse.setPitchArea(chn, 90, 45, 170);
muse.setAims(chn, NoteType, NoteVal, Nothing);
muse.setMidiArea(chn, NoteVal, 23, 96);
muse.setMidiArea(chn, NoteType, 2, 12);
muse.setMapping(chn, BiLinear, BiLinear, BiLinear);
}
// ****************************************************************************
// Z u s t a n d s m a s c h i n e S O A A P - A n w e n d u n g (ap)
// ****************************************************************************
......@@ -352,14 +410,15 @@ void apWaitDE()
dword apWaitMeasCnt;
void apWaitMeas()
{
int snr;
apWaitMeasCnt++;
// Ermitteln, ob einer der Slaves einen Messwert hat
//
for(curListIdx = 0; curListIdx < apNrOfSlaves; curListIdx++)
{
slNr = apSlaveList[curListIdx];
if(blePoll.measAvail(slNr)) break;
snr = apSlaveList[curListIdx];
if(blePoll.measAvail(snr)) break;
}
if(curListIdx == apNrOfSlaves) return;
// Wenn kein Slave neue Messwerte hat,
......@@ -402,7 +461,7 @@ void apProcMeas()
// Daten überprüfen (auswerten)
//
short accXold, accYold, accZold;
float rollOld, pitchOld, yawOld;
float rollMeasValue, pitchMeasValue, yawMeasValue;
dword apCheckValuesCnt;
void apCheckValues()
{
......@@ -420,9 +479,9 @@ void apCheckValues()
break;
case BlePoll::atSOAAP2:
rollOld = * (float *) &apMeasByteArray[0];
pitchOld = * (float *) &apMeasByteArray[4];
yawOld = * (float *) &apMeasByteArray[8];
rollMeasValue = * (float *) &apMeasByteArray[0];
pitchMeasValue = * (float *) &apMeasByteArray[4];
yawMeasValue = * (float *) &apMeasByteArray[8];
break;
}
......@@ -430,106 +489,11 @@ void apCheckValues()
ap.enter(apCalcResult);
}
// ----------------------------------------------------------------------------
// Daten auf Midi-Noten abbilden
//
//short borderLowAz = 100;
//short borderHighAz = 8000;
//short borderLowAy = 100;
//short borderHighAy = 8300;
//short borderLowAx = 100;
//short borderHighAx = 4000;
//byte lowNote = 23;
//byte highNote = 72;
//byte highNote = 96;
void setParM1()
{
val2midArr[1].borderLowAz = 100;
val2midArr[1].borderHighAz = 8000;
val2midArr[1].borderLowAy = 100;
val2midArr[1].borderHighAy = 8300;
val2midArr[1].borderLowAx = 100;
val2midArr[1].borderHighAx = 4000;
val2midArr[1].lowNote = 23;
val2midArr[1].highNote = 96;
}
void setParM2()
{
val2midArr[2].borderLowAz = 100;
val2midArr[2].borderHighAz = 8000;
val2midArr[2].borderLowAy = 100;
val2midArr[2].borderHighAy = 8300;
val2midArr[2].borderLowAx = 100;
val2midArr[2].borderHighAx = 4000;
val2midArr[2].lowNote = 23;
val2midArr[2].highNote = 96;
}
void setParP1()
{
Posture2MidiPtr pmp = &post2midArr[1];
pmp->offsetRoll = 90;
pmp->borderLowRoll = 45;
pmp->borderHighRoll = 170;
pmp->aimRoll = NoteType;
pmp->offsetPitch = 90;
pmp->borderLowPitch = 45;
pmp->borderHighPitch = 170;
pmp->aimPitch = NoteVal;
pmp->midiBords[NoteVal].low = 23;
pmp->midiBords[NoteVal].high = 96;
pmp->midiBords[NoteType].low = 2;
pmp->midiBords[NoteType].high = 12;
pmp->koeffRoll =
(pmp->midiBords[pmp->aimRoll].high - pmp->midiBords[pmp->aimRoll].low) /
(pmp->borderHighRoll - pmp->borderLowRoll);
pmp->koeffPitch =
(pmp->midiBords[pmp->aimPitch].high - pmp->midiBords[pmp->aimPitch].low) /
(pmp->borderHighPitch - pmp->borderLowPitch);
}
void setParP2()
{
Posture2MidiPtr pmp = &post2midArr[2];
pmp->offsetRoll = 90;
pmp->borderLowRoll = 45;
pmp->borderHighRoll = 170;
pmp->aimRoll = NoteType;
pmp->offsetPitch = 90;
pmp->borderLowPitch = 45;
pmp->borderHighPitch = 170;
pmp->aimPitch = NoteVal;
pmp->midiBords[NoteVal].low = 23;
pmp->midiBords[NoteVal].high = 96;
pmp->midiBords[NoteType].low = 2;
pmp->midiBords[NoteType].high = 12;
pmp->koeffRoll =
(pmp->midiBords[pmp->aimRoll].high - pmp->midiBords[pmp->aimRoll].low) /
(pmp->borderHighRoll - pmp->borderLowRoll);
pmp->koeffPitch =
(pmp->midiBords[pmp->aimPitch].high - pmp->midiBords[pmp->aimPitch].low) /
(pmp->borderHighPitch - pmp->borderLowPitch);
}
byte resultAz;
byte resultAy;
byte resultAx;
byte resultNote[3];
MidiResult midiResult[3];
dword apCalcResultCnt;
void apCalcResult()
......@@ -538,6 +502,7 @@ void apCalcResult()
int result;
float rollVal, pitchVal, yawVal;
Meas2Midi meas2midi;
bool newResult;
apCalcResultCnt++;
......@@ -568,44 +533,61 @@ void apCalcResult()
break;
case BlePoll::atSOAAP2:
rollVal = rollOld + post2midArr[slNr].offsetRoll; // Rollwinkel in positiven Bereich verschieben
if(rollVal < post2midArr[slNr].borderLowRoll)
result = muse.resultRoll(slNr, &midiResult[0], rollMeasValue);
if(result < 0)
{
rollVal = post2midArr[slNr].borderLowRoll; // Inhalt ggf. auf Minimalwert begrenzen
// Bereich verlassen (links)
ap.enter(apWaitMeas);
return;
}
else if(rollVal > post2midArr[slNr].borderHighRoll)
else if(result > 0)
{
rollVal = post2midArr[slNr].borderHighRoll; // Inhalt ggf. auf Maximalwert begrenzen
// Bereich verlassen (rechts)
ap.enter(apWaitMeas);
return;
}
meas2midi = post2midArr[slNr].aimRoll;
resultNote[meas2midi] =
post2midArr[slNr].midiBords[meas2midi].low +
(byte) ((rollVal - post2midArr[slNr].borderLowRoll) * post2midArr[slNr].koeffRoll);
pitchVal = pitchOld + post2midArr[slNr].offsetPitch; // Pitchwinkel in positiven Bereich verschieben
if(pitchVal < post2midArr[slNr].borderLowPitch)
result = muse.resultPitch(slNr, &midiResult[1], pitchMeasValue);
if(result < 0)
{
pitchVal = post2midArr[slNr].borderLowPitch; // Inhalt ggf. auf Minimalwert begrenzen
// Bereich verlassen (links)
ap.enter(apWaitMeas);
return;
}
else if(pitchVal > post2midArr[slNr].borderHighPitch)
else if(result > 0)
{
pitchVal = post2midArr[slNr].borderHighPitch; // Inhalt ggf. auf Maximalwert begrenzen
// Bereich verlassen (rechts)
ap.enter(apWaitMeas);
return;
}
meas2midi = post2midArr[slNr].aimPitch;
resultNote[meas2midi] =
post2midArr[slNr].midiBords[meas2midi].low +
(byte) ((pitchVal - post2midArr[slNr].borderLowPitch) * post2midArr[slNr].koeffPitch);
resultNote[NoteVel] = 100;
midiResult[2].type = NoteVel;
midiResult[2].value = 100;
break;
}
newResult = false;
for(int i = 0; i < 3; i++)
{
if(midiResult[i].newVal)
{
midiResult[i].newVal = false;
newResult = true;
}
}
if(newResult)
ap.enter(apSetResult);
else
ap.enter(apWaitMeas);
}
// ----------------------------------------------------------------------------
// Bedienen des Midi-Controller
//
dword apSetResultCnt;
byte noteTypeIn, noteValIn, noteVelIn;
void apSetResult()
{
apSetResultCnt++;
......@@ -620,22 +602,21 @@ void apSetResult()
break;
case BlePoll::atSOAAP2:
for(int i = 0; i < 3; i++)
{
if(midiResult[i].type == NoteType)
noteTypeIn = midiResult[i].value;
else if(midiResult[i].type == NoteVal)
noteValIn = midiResult[i].value;
else if(midiResult[i].type == NoteVel)
noteVelIn = midiResult[i].value;
}
if(slNr == 1)
midi1.setChordNote
(
lastNoteIdxM1,
(MidiNotes::NoteTypeIdx) resultNote[NoteType],
resultNote[NoteVal],
resultNote[NoteVel]
);
midi1.setChordNote(lastNoteIdxM1,(MidiNotes::NoteTypeIdx) noteTypeIn, noteValIn, noteVelIn);
else if(slNr == 2)
midi2.setChordNote
(
lastNoteIdxM1,
(MidiNotes::NoteTypeIdx) resultNote[NoteType],
resultNote[NoteVal],
resultNote[NoteVel]
);
midi2.setChordNote(lastNoteIdxM1,(MidiNotes::NoteTypeIdx) noteTypeIn, noteValIn, noteVelIn);
break;
}
......@@ -749,7 +730,7 @@ void smCtrlPolling()
short tmpShort;
int i;
PlpMeas6Ptr resPtr;
PlPduMeasPtr resPtr;
if(sm.firstEnter())
{
......@@ -870,20 +851,15 @@ void smCtrlPolling()
}
mon.print(tmpDw); mon.cprint(' ');
resPtr = (PlpMeas6Ptr) &slPtr->result;
resPtr = (PlPduMeasPtr) &slPtr->result;
mon.print(slPtr->cntLostPdu); mon.cprint('|');
mon.print(slPtr->cntErrCrc); mon.cprint('|');
//mon.print(slPtr->result.measCnt); mon.cprint('|');
mon.print(resPtr->measCnt); mon.cprint('|');
mon.print(slPtr->cntLostMeas); mon.cprint(' ');
mon.print(resPtr->plData,12,'.');
for(i = 0; i < 6; i++)
{
//tmpShort = (short) slPtr->result.meas[i];
tmpShort = (short) resPtr->meas[i];
mon.prints(tmpShort); mon.cprint(' ');
}
mon.print((char *) " Poll[");
mon.print(slPtr->pIdx);
mon.print((char *) "] ");
......@@ -892,8 +868,6 @@ void smCtrlPolling()
sm.resetEnter();
}
else
{
if(mon.lastKeyIn == ' ')
......@@ -1009,12 +983,18 @@ void smReadPollValues()
char *caHelp =
{
"c Zyklen der Zustandsmaschine\r\n"
"m Ausgabe Midiwerte\r\n"
#ifdef MeasMuseDebug
"d Debug MeasMuse\r\n"
#endif
"m Anzeige Midiwerte\r\n"
"v Anzeige Messwerte\r\n"
"Leerzeichen für Abbruch\r\n"
};
void smCheckApp()
{
char conv[32];
if(sm.firstEnter())
{
mon.print((char *) "Check App ");
......@@ -1041,13 +1021,42 @@ void smCheckApp()
mon.println(apSetResultCnt);
sm.resetEnter();
}
#ifdef MeasMuseDebug
else if(mon.lastKeyIn == 'D' || mon.lastKeyIn == 'd')
{
mon.cprintln('d');
mon.print(slNr);
sprintf(conv," inVal=%f",muse.config[slNr].debInValRoll);
mon.print(conv);
sprintf(conv," LowRoll=%f",muse.config[slNr].borderLowRoll);
mon.print(conv);
sprintf(conv," HighRoll=%f",muse.config[slNr].borderHighRoll);
mon.print(conv);
sprintf(conv," koeff=%f ",muse.config[slNr].koeffRoll);
mon.print(conv);
mon.println(muse.config[slNr].debResVal);
sm.resetEnter();
}
#endif
else if(mon.lastKeyIn == 'M' || mon.lastKeyIn == 'm')
{
mon.cprintln('m');
mon.print(slNr); mon.cprint(' ');
mon.print(resultNote[NoteType]); mon.cprint(' ');
mon.print(resultNote[NoteVal]); mon.cprint(' ');
mon.println(resultNote[NoteVel]);
mon.print(noteTypeIn); mon.cprint(' ');
mon.print(noteValIn); mon.cprint(' ');
mon.println(noteVelIn);
sm.resetEnter();
}
else if(mon.lastKeyIn == 'V' || mon.lastKeyIn == 'v')
{
mon.cprintln('v');
mon.print(slNr); mon.cprint(' ');
sprintf(conv,"r=%f",rollMeasValue);
mon.print(conv); mon.cprint(' ');
sprintf(conv," p=%f",pitchMeasValue);
mon.print(conv); mon.cprint(' ');
sprintf(conv," y=%f",yawMeasValue);
mon.println(conv);
sm.resetEnter();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment