mirror of
https://github.com/steve-chamberlin/mac-rom-simm-programmer.software.git
synced 2024-12-22 08:30:44 +00:00
Prettified more source code and began work on a dropdown menu for the
chip size.
This commit is contained in:
parent
0dfe69cbf8
commit
0e9736dcb2
@ -11,10 +11,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
p = new Programmer();
|
||||
ui->setupUi(this);
|
||||
ui->pages->setCurrentWidget(ui->notConnectedPage);
|
||||
ui->actionUpdate_firmware->setEnabled(false);
|
||||
p = new Programmer();
|
||||
|
||||
// Fill in the list of SIMM chip capacities (should support chips ranging from 128KB to 512KB in size (= 1, 2, or 4 Mb)
|
||||
ui->simmCapacityBox->addItem("128 KB (1 Mb) per chip * 4 chips = 512 KB", QVariant(512 * 1024));
|
||||
ui->simmCapacityBox->addItem("256 KB (2 Mb) per chip * 4 chips = 1 MB", QVariant(1 * 1024 * 1024));
|
||||
ui->simmCapacityBox->addItem("512 KB (4 Mb) per chip * 4 chips = 2 MB", QVariant(2 * 1024 * 1024));
|
||||
|
||||
ui->chosenWriteFile->setText("");
|
||||
ui->chosenReadFile->setText("");
|
||||
writeFileValid = false;
|
||||
@ -368,7 +374,15 @@ void MainWindow::programmerBoardDisconnectedDuringOperation()
|
||||
|
||||
void MainWindow::resetAndShowStatusPage()
|
||||
{
|
||||
ui->progressBar->setValue(0);
|
||||
//ui->progressBar->setValue(0);
|
||||
// Show indeterminate progress bar until communication succeeds/fails
|
||||
ui->progressBar->setRange(0, 0);
|
||||
ui->statusLabel->setText("Communicating with programmer (this may take a few seconds)...");
|
||||
ui->pages->setCurrentWidget(ui->statusPage);
|
||||
}
|
||||
|
||||
void MainWindow::on_simmCapacityBox_currentIndexChanged(int index)
|
||||
{
|
||||
uint32_t newCapacity = (uint32_t)ui->simmCapacityBox->itemData(index).toUInt();
|
||||
p->setSIMMCapacity(newCapacity);
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ private slots:
|
||||
void programmerBoardDisconnected();
|
||||
void programmerBoardDisconnectedDuringOperation();
|
||||
|
||||
void on_simmCapacityBox_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
bool writeFileValid;
|
||||
|
@ -28,6 +28,33 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="controlPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="simmCapacityLabel">
|
||||
<property name="text">
|
||||
<string>SIMM capacity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="simmCapacityBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="writeGroupBox">
|
||||
<property name="title">
|
||||
|
@ -165,9 +165,6 @@ void Programmer::readSIMMToFile(QString filename)
|
||||
readFile->open(QFile::WriteOnly);
|
||||
lenRead = 0;
|
||||
|
||||
emit readTotalLengthChanged(2 * 1024 * 1024);
|
||||
emit readCompletionLengthChanged(lenRead);
|
||||
|
||||
startProgrammerCommand(ReadChips, ReadSIMMWaitingStartReply);
|
||||
}
|
||||
|
||||
@ -182,8 +179,6 @@ void Programmer::writeFileToSIMM(QString filename)
|
||||
}
|
||||
lenWritten = 0;
|
||||
writeLenRemaining = writeFile->size();
|
||||
emit writeTotalLengthChanged(writeLenRemaining);
|
||||
emit writeCompletionLengthChanged(lenWritten);
|
||||
|
||||
startProgrammerCommand(EraseChips, WriteSIMMWaitingEraseReply);
|
||||
}
|
||||
@ -225,6 +220,8 @@ void Programmer::handleChar(uint8_t c)
|
||||
curState = WriteSIMMWaitingWriteReply;
|
||||
qDebug() << "Chips erased. Now asking to start writing...";
|
||||
emit writeStatusChanged(WriteEraseComplete);
|
||||
emit writeTotalLengthChanged(writeLenRemaining);
|
||||
emit writeCompletionLengthChanged(lenWritten);
|
||||
break;
|
||||
case CommandReplyError:
|
||||
qDebug() << "Error erasing chips.";
|
||||
@ -385,6 +382,8 @@ void Programmer::handleChar(uint8_t c)
|
||||
case ReadSIMMWaitingStartReply:
|
||||
emit readStatusChanged(ReadStarting);
|
||||
curState = ReadSIMMWaitingData;
|
||||
emit readTotalLengthChanged(_simmCapacity);
|
||||
emit readCompletionLengthChanged(0);
|
||||
readChunkLenRemaining = READ_CHUNK_SIZE;
|
||||
break;
|
||||
case ReadSIMMWaitingData:
|
||||
@ -889,3 +888,13 @@ void Programmer::closePort()
|
||||
{
|
||||
serialPort->close();
|
||||
}
|
||||
|
||||
void Programmer::setSIMMCapacity(uint32_t bytes)
|
||||
{
|
||||
_simmCapacity = bytes;
|
||||
}
|
||||
|
||||
uint32_t Programmer::SIMMCapacity()
|
||||
{
|
||||
return _simmCapacity;
|
||||
}
|
||||
|
@ -83,6 +83,8 @@ public:
|
||||
void getChipIdentity(int chipIndex, uint8_t *manufacturer, uint8_t *device);
|
||||
void flashFirmware(QString filename);
|
||||
void startCheckingPorts();
|
||||
void setSIMMCapacity(uint32_t bytes);
|
||||
uint32_t SIMMCapacity();
|
||||
signals:
|
||||
void startStatusChanged(StartStatus status);
|
||||
|
||||
@ -117,6 +119,7 @@ private:
|
||||
void sendByte(uint8_t b);
|
||||
uint8_t readByte();
|
||||
void handleChar(uint8_t c);
|
||||
uint32_t _simmCapacity;
|
||||
|
||||
uint32_t writeLenRemaining;
|
||||
uint32_t lenWritten;
|
||||
|
Loading…
Reference in New Issue
Block a user