aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2020-10-18 21:20:00 -0400
committerClyne Sullivan <clyne@bitgloo.com>2020-10-18 21:20:00 -0400
commit241a089c39c77345e8e0a0c8a04301ba2271e432 (patch)
treeebce9026eed4bd0561f4422fcdc35149ba338487 /gui
parent9c98bfb62c3d981eb95957186b3c85e735e0b2f5 (diff)
document/standardize; add compile log to gui
Diffstat (limited to 'gui')
-rw-r--r--gui/stmdsp.cpp12
-rw-r--r--gui/stmdsp.hpp2
-rw-r--r--gui/wxmain.cpp18
-rw-r--r--gui/wxmain.hpp3
4 files changed, 24 insertions, 11 deletions
diff --git a/gui/stmdsp.cpp b/gui/stmdsp.cpp
index bbfc716..8f19065 100644
--- a/gui/stmdsp.cpp
+++ b/gui/stmdsp.cpp
@@ -25,10 +25,10 @@ namespace stmdsp
}
}
- std::vector<adcsample_t> device::sample(unsigned long int count) {
+ /*std::vector<adcsample_t> device::sample(unsigned long int count) {
if (connected()) {
uint8_t request[3] = {
- 'r',
+ 'd',
static_cast<uint8_t>(count),
static_cast<uint8_t>(count >> 8)
};
@@ -39,7 +39,7 @@ namespace stmdsp
} else {
return {};
}
- }
+ }*/
void device::continuous_start() {
if (connected())
@@ -63,7 +63,7 @@ namespace stmdsp
std::vector<adcsample_t> device::continuous_read() {
if (connected()) {
- m_serial.write("s");
+ m_serial.write("a");
std::vector<adcsample_t> data (2048);
m_serial.read(reinterpret_cast<uint8_t *>(data.data()), 2048 * sizeof(adcsample_t));
return data;
@@ -80,7 +80,7 @@ namespace stmdsp
void device::upload_filter(unsigned char *buffer, size_t size) {
if (connected()) {
uint8_t request[3] = {
- 'e',
+ 'E',
static_cast<uint8_t>(size),
static_cast<uint8_t>(size >> 8)
};
@@ -92,6 +92,6 @@ namespace stmdsp
void device::unload_filter() {
if (connected())
- m_serial.write("E");
+ m_serial.write("e");
}
}
diff --git a/gui/stmdsp.hpp b/gui/stmdsp.hpp
index 06d36ba..2d336c5 100644
--- a/gui/stmdsp.hpp
+++ b/gui/stmdsp.hpp
@@ -38,7 +38,7 @@ namespace stmdsp
return m_serial.isOpen();
}
- std::vector<adcsample_t> sample(unsigned long int count = 1);
+ //std::vector<adcsample_t> sample(unsigned long int count = 1);
void continuous_start();
void continuous_start_measure();
diff --git a/gui/wxmain.cpp b/gui/wxmain.cpp
index d4f4878..874f26e 100644
--- a/gui/wxmain.cpp
+++ b/gui/wxmain.cpp
@@ -63,9 +63,13 @@ MainFrame::MainFrame() : wxFrame(nullptr, -1, "stmdspgui", wxPoint(50, 50), wxSi
auto window = new wxBoxSizer(wxVERTICAL);
- m_text_editor = new wxStyledTextCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(620, 700));
+ m_text_editor = new wxStyledTextCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(620, 500));
prepareEditor();
- window->Add(m_text_editor, 1, wxEXPAND | wxALL, 10);
+ window->Add(m_text_editor, 2, wxEXPAND | wxALL, 10);
+
+ m_compile_output = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
+ wxTE_READONLY | wxTE_MULTILINE | wxHSCROLL);
+ window->Add(m_compile_output, 1, wxEXPAND | wxALL, 10);
SetSizerAndFit(window);
@@ -168,9 +172,15 @@ wxString MainFrame::compileEditorCode()
makefile.Write(make_text);
makefile.Close();
+ wxString make_output = temp_file_name + "make.log";
wxString make_command = wxString("make -C ") + temp_file_name.BeforeLast('/') +
- " -f " + temp_file_name + "make";
- if (system(make_command.ToAscii()) == 0) {
+ " -f " + temp_file_name + "make" +
+ " > " + make_output + " 2>&1";
+
+ int result = system(make_command.ToAscii());
+ m_compile_output->LoadFile(make_output);
+
+ if (result == 0) {
m_status_bar->SetStatusText("Compilation succeeded.");
return temp_file_name + ".o";
} else {
diff --git a/gui/wxmain.hpp b/gui/wxmain.hpp
index b8ff11d..268a08d 100644
--- a/gui/wxmain.hpp
+++ b/gui/wxmain.hpp
@@ -3,7 +3,9 @@
#include "stmdsp.hpp"
+#include <fstream>
#include <future>
+#include <iostream>
#include <thread>
#include <wx/button.h>
#include <wx/combobox.h>
@@ -39,6 +41,7 @@ private:
bool m_is_running = false;
wxComboBox *m_device_combo = nullptr;
wxStyledTextCtrl *m_text_editor = nullptr;
+ wxTextCtrl *m_compile_output = nullptr;
wxControl *m_signal_area = nullptr;
wxMenuItem *m_run_measure = nullptr;
wxTimer *m_measure_timer = nullptr;