Skip to content

Commit 9346e36

Browse files
committed
add board selection. apparently this just works?
1 parent 705c61c commit 9346e36

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Source/Heavy/OWLExporter.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class OWLExporter : public ExporterBase {
88
public:
9-
// Value targetBoardValue = Value(var(1));
9+
Value targetBoardValue = Value(var(1));
1010
Value exportTypeValue = SynchronousValue(var(3));
1111
Value storeSlotValue = SynchronousValue(var(1));
1212

@@ -18,7 +18,7 @@ class OWLExporter : public ExporterBase {
1818
: ExporterBase(editor, exportingView)
1919
{
2020
Array<PropertiesPanelProperty*> properties;
21-
// properties.add(new PropertiesPanel::ComboComponent("Target board", targetBoardValue, { "OWL2", "OWL3" }));
21+
properties.add(new PropertiesPanel::ComboComponent("Target board", targetBoardValue, { "OWL2", "OWL3" }));
2222
properties.add(new PropertiesPanel::ComboComponent("Export type", exportTypeValue, { "Source code", "Binary", "Load", "Store" }));
2323
storeSlotProperty = new PropertiesPanel::ComboComponent("Store slot", storeSlotValue, { "1", "2", "3", "4", "5", "6", "7", "8" });
2424
properties.add(storeSlotProperty);
@@ -37,7 +37,7 @@ class OWLExporter : public ExporterBase {
3737
flashButton.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f));
3838
flashButton.setColour(ComboBox::outlineColourId, Colours::transparentBlack);
3939

40-
// targetBoardValue.addListener(this);
40+
targetBoardValue.addListener(this);
4141
exportTypeValue.addListener(this);
4242
storeSlotValue.addListener(this);
4343

@@ -51,6 +51,7 @@ class OWLExporter : public ExporterBase {
5151
ValueTree getState() override
5252
{
5353
ValueTree stateTree("OWL");
54+
stateTree.setProperty("targetBoardValue", getValue<int>(targetBoardValue), nullptr);
5455
stateTree.setProperty("exportTypeValue", getValue<int>(exportTypeValue), nullptr);
5556
stateTree.setProperty("storeSlotValue", getValue<int>(storeSlotValue), nullptr);
5657
return stateTree;
@@ -59,6 +60,7 @@ class OWLExporter : public ExporterBase {
5960
void setState(ValueTree& stateTree) override
6061
{
6162
auto tree = stateTree.getChildWithName("OWL");
63+
targetBoardValue = tree.getProperty("targetBoardValue");
6264
exportTypeValue = tree.getProperty("exportTypeValue");
6365
storeSlotValue = tree.getProperty("storeSlotValue");
6466
}
@@ -85,7 +87,7 @@ class OWLExporter : public ExporterBase {
8587

8688
bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override
8789
{
88-
// auto target = getValue<int>(targetBoardValue) - 1;
90+
auto target = getValue<int>(targetBoardValue);
8991
bool compile = getValue<int>(exportTypeValue) - 1;
9092
bool load = getValue<int>(exportTypeValue) == 3;
9193
bool store = getValue<int>(exportTypeValue) == 4;
@@ -157,18 +159,23 @@ class OWLExporter : public ExporterBase {
157159
+ " BUILD=../"
158160
+ " PATCHNAME=" + name
159161
+ " PATCHCLASS=HeavyPatch"
160-
+ " PATCHFILE=HeavyOWL_" + name + ".hpp"
161-
+ " PLATFORM=OWL2";
162+
+ " PATCHFILE=HeavyOWL_" + name + ".hpp";
162163
#else
163164
buildScript += make.getFullPathName()
164165
+ " -j4"
165166
+ " TOOLROOT=" + gccPath + "/"
166167
+ " BUILD=../"
167168
+ " PATCHNAME=" + name
168169
+ " PATCHCLASS=HeavyPatch"
169-
+ " PATCHFILE=HeavyOWL_" + name + ".hpp"
170-
+ " PLATFORM=OWL2";
170+
+ " PATCHFILE=HeavyOWL_" + name + ".hpp";
171171
#endif
172+
173+
if (target == 1) {
174+
buildScript += " PLATFORM=OWL2";
175+
} else if (target == 2) {
176+
buildScript += " PLATFORM=OWL3";
177+
}
178+
172179
if (load) {
173180
// load into flash memory
174181
buildScript += " load";

0 commit comments

Comments
 (0)