From 2e88f63a73d0c5f860f18d8d536f20cac07f7de3 Mon Sep 17 00:00:00 2001 From: David Hale Date: Tue, 13 Oct 2026 11:23:51 -0700 Subject: [PATCH 1/2] bugfix: emulator answers FRAME before ACF is loaded as real Archon does starts in the BIGBUF=0 buffer state through set_bigbuf(), which the BIGBUF handler now also calls --- emulator/emulator-archon.cpp | 44 ++++++++++++++++++++++++------------ emulator/emulator-archon.h | 1 + 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/emulator/emulator-archon.cpp b/emulator/emulator-archon.cpp index b84dd35..df186cd 100644 --- a/emulator/emulator-archon.cpp +++ b/emulator/emulator-archon.cpp @@ -77,6 +77,11 @@ namespace Archon { exit(1); } + // Start with the frame buffers a real Archon reports at power-up, + // before any ACF has been loaded. + // + this->set_bigbuf( false ); + struct timespec ts; // container for the time if ( clock_gettime( CLOCK_REALTIME, &ts ) != 0 ) { this->init_time = 0; @@ -345,11 +350,6 @@ namespace Archon { std::string timenow; std::stringstream framestr; - if ( this->image->activebufs == -1 ) { - std::cerr << get_timestamp() << function << "ERROR: activebufs undefined. Check that an ACF was loaded and that it contains BIGBUF=x\n"; - return ERROR; - } - this->timer_report( this->frame.timer ); framestr << "TIMER=" << this->frame.timer << " " @@ -497,6 +497,29 @@ namespace Archon { /***** Interface:fetch_data *************************************************/ + /***** Interface::set_bigbuf ************************************************/ + /** + * @brief sets the frame buffer layout selected by BIGBUF + * @param[in] bigbuf true for BIGBUF=1, false for BIGBUF=0 + * + * Sets the number of active frame buffers and their base addresses. + * + */ + void Interface::set_bigbuf( bool bigbuf ) { + this->bigbuf = bigbuf; + this->image->activebufs = ( this->bigbuf ? 2 : 3 ); + this->frame.bufbase.at(0) = 0xA0000000; + if ( this->bigbuf ) { + this->frame.bufbase.at(1) = 0xD0000000; + } + else { + this->frame.bufbase.at(1) = 0xC0000000; + this->frame.bufbase.at(2) = 0xE0000000; + } + } + /***** Interface::set_bigbuf ************************************************/ + + /***** Interface:wconfig ****************************************************/ /** * @brief handles the incoming WCONFIG command @@ -593,16 +616,7 @@ namespace Archon { // Some keywords in this category are used to assign certain class variables // if ( key == "BIGBUF" ) { - this->bigbuf = ( std::stoi(value)==1 ? true : false ); - this->image->activebufs = ( this->bigbuf ? 2 : 3 ); - this->frame.bufbase.at(0) = 0xA0000000; - if ( this->bigbuf ) { - this->frame.bufbase.at(1) = 0xD0000000; - } - else { - this->frame.bufbase.at(1) = 0xC0000000; - this->frame.bufbase.at(2) = 0xE0000000; - } + this->set_bigbuf( std::stoi(value)==1 ? true : false ); } else if ( key == "TAPLINES" ) { diff --git a/emulator/emulator-archon.h b/emulator/emulator-archon.h index 8e718df..9bc034b 100644 --- a/emulator/emulator-archon.h +++ b/emulator/emulator-archon.h @@ -131,6 +131,7 @@ namespace Archon { long wconfig(std::string buf); //!< long rconfig(std::string buf, std::string &retstring); long write_parameter(std::string buf); + void set_bigbuf( bool bigbuf ); //!< sets frame buffer count and base addresses static void dothread_expose( Archon::Interface &iface, int numexpose ); // TODO ***** below here need to check what's needed ********************************************************** From 4530ce52f94c9cb77b1106f98525bba8df4f4bbb Mon Sep 17 00:00:00 2001 From: David Hale Date: Tue, 13 Oct 2026 11:34:42 -0700 Subject: [PATCH 2/2] bugfix: open fails when FRAME fails instead of replying DONE --- camerad/archon_controller.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/camerad/archon_controller.cpp b/camerad/archon_controller.cpp index 9f26979..c4f2a3d 100644 --- a/camerad/archon_controller.cpp +++ b/camerad/archon_controller.cpp @@ -366,7 +366,9 @@ namespace Camera { // Ensures these values are set on startup // - this->get_frame_status(); + if (this->get_frame_status() != NO_ERROR) { + throw std::runtime_error("getting FRAME status"); + } if (this->lastframe==0) { for (int i=0; i