-
Notifications
You must be signed in to change notification settings - Fork 73
USB Protection Improvement and ExamMode Fix #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 22 commits
aef43bf
5c7e4be
6f47e94
e3740cb
d8dbd1f
de478a3
2623637
762be7b
8c3398d
65419f5
c425a8c
3b5333c
726fd3e
e8d75aa
fb428ca
0293797
c7b24be
a412f38
6b4d21f
ef57ed7
473b83b
674b8af
b06f4f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| #include <cmath> | ||
| #include <poincare/preferences.h> | ||
| #include <apps/i18n.h> | ||
| #include <ion.h> | ||
|
|
||
| using namespace Poincare; | ||
| using namespace Shared; | ||
|
|
@@ -112,7 +113,11 @@ GlobalPreferences::ExamMode ExamModeController::examMode() { | |
| GlobalPreferences::ExamMode mode = GlobalPreferences::sharedGlobalPreferences()->tempExamMode(); | ||
| if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { | ||
| // If the exam mode is already on, this re-activate the same exam mode | ||
| #if ION_SIMULATOR_FILES | ||
| mode = GlobalPreferences::ExamMode::Off; | ||
| #else | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these lines should be removed, because this pull request is marked as ready for review
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know because it add the possibility to disable the exam mode in the simulator without rebooting
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but it is marked as ready to merge…
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed because I think it can be a good idea to add the possibility to disable the exam mode in simulators ^^ The exam mode in simulator doesn't make any sense in the first place because you can always leave the simulator and open others app so I don't see the problem by adding the option
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but if we look #131, it is built as a simulator, but it runs on the calculator…
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree with Yaya-Cout |
||
| mode = GlobalPreferences::sharedGlobalPreferences()->examMode(); | ||
| #endif | ||
| } | ||
| return mode; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -78,6 +78,7 @@ class Function : public ExpressionModelHandle { | |||||
| } | ||||||
| bool isActive() const { return m_active; } | ||||||
| void setActive(bool active) { m_active = active; } | ||||||
| void setMyColor(KDColor color) {m_color = color; } | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, is it possible to give a better name to the function?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setGraphColor ? |
||||||
| private: | ||||||
| #if __EMSCRIPTEN__ | ||||||
| /* For emscripten memory representation, loads and stores must be aligned; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -245,7 +245,7 @@ void __attribute__((noinline)) start() { | |||||
| Ion::Device::Board::initFPU(); | ||||||
|
|
||||||
| /* Call static C++ object constructors | ||||||
| * The C++ compiler creates an initialization function for each static object. | ||||||
| * The C++ compiler creates an initialization function for each static object. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * The linker then stores the address of each of those functions consecutively | ||||||
| * between _init_array_start and _init_array_end. So to initialize all C++ | ||||||
| * static objects we just have to iterate between theses two addresses and | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ void DFUInterface::wholeDataSentCallback(SetupPacket *request, uint8_t *transfer | |
| // Leave DFU routine: Leave DFU, reset device, jump to application code | ||
| leaveDFUAndReset(); | ||
| } else if (m_state == State::dfuDNBUSY) { | ||
| m_state = State::dfuDNBUSY; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this line... |
||
| if (m_largeBufferLength != 0) { | ||
| // Here, copy the data from the transfer buffer to the flash memory | ||
| writeOnMemory(); | ||
|
|
@@ -152,7 +153,7 @@ bool DFUInterface::processUploadRequest(SetupPacket *request, uint8_t *transferB | |
| } else { | ||
| /* We decided to never protect Read operation. Else we would have to check | ||
| * here it is not protected before reading. */ | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
| // Compute the reading address | ||
| uint32_t readAddress = (request->wValue() - 2) * Endpoint0::MaxTransferSize + m_addressPointer; | ||
| // Copy the requested memory zone into the transfer buffer. | ||
|
|
@@ -188,7 +189,7 @@ void DFUInterface::changeAddressPointerIfNeeded() { | |
|
|
||
| void DFUInterface::eraseCommand(uint8_t *transferBuffer, uint16_t transferBufferLength) { | ||
| /* We determine whether the commands asks for a mass erase or which sector to | ||
| * erase. The erase must be done after the next getStatus request. */ | ||
| * erase. The erase must be done after the next getStatus request. */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it has been squashed when merging, but this fork isn't up-to-date, so it isn't corrected in this repo |
||
| m_state = State::dfuDNLOADSYNC; | ||
|
|
||
| if (transferBufferLength == 1) { | ||
|
|
@@ -217,7 +218,6 @@ void DFUInterface::eraseMemoryIfNeeded() { | |
| if (m_erasePage < 0) { | ||
| return; | ||
| } | ||
|
|
||
| willErase(); | ||
|
|
||
| #if 0 // We don't erase now the flash memory to avoid crash if writing is refused | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.