Download presentation
Presentation is loading. Please wait.
1
Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and code review
2
Lab 3 – Bio-feedback Should be LED 5
3
Lab. 4 Use SPI interface, cause the words “Happy 511 Christmas” to appear on the LCD screen (60%) Manual version down in class – Nov 19 th (40%) 6/18/2015SPI and LCD, Copyright M. Smith, ECE, University of Calgary, Canada 3 / 30
4
Lab. 4 -- LCD interface Full SPI controller Note – readiness need for 19 November as demo encurring in class time and not lab time
5
See Lab 4 notes for more details
6
Some of the requirements for Lab 3 Should be LED 5
7
Design the task state diagram
8
Develop Basic Test for FlashLED6 “working”
9
Build Test -- Tells us what functions need developing ‘Quick fix’ to use new function names without having to change Lab 1 names Re-factor later (Feb 2011)
10
Write “enough” code to satisfy the Tests Why is using ‘current state’ better than reading current LED values? Are there ‘defect’s” in this code
11
[ What are the “syntax” errors in Flash6( )? Ignore “logical errors” at this time ] A.[In lines 16 to 20] B.[In lines 21 to 24] C.[In lines 25 to 28] D.[In lines 29 to 32] E.[In lines 33 to 36 ] [Default] [MC Any] [MC All]
12
Defects The number of syntax errors you did not find before compiler – meaning the ones the compiler found after your code review IS A PROXY FOR The number of logical defects STILL present in your code DO A PROPER CODE REVIEW
13
[ What are the “logical” defects? Only the defects that would cause this simple Test to fail ] A.[ In lines 16 to 20] B.[In lines 21 to 24] C.[In lines 25 to 28] D.[In lines 29 to 32] E.[In lines 33 to 36]
14
Running the TEST
15
Identify the defect -- This is NOT a syntax error as compiler worked Each time this function “starts” currentState is reset to STATE1_ON 3 defects as well
16
Develop Basic Test for FlashLED6 “working properly” DO CODE REVIEW This test worries about requirement that other LED’s not impacted by FlashLED6
17
[Do Code review Where are the “syntax errors”] A.[31 33] B.[35 37] C.[42 45] D.[47 48] E.[50 53] The number of syntax errors you did not find before compiler – meaning the ones the compiler found after your code review IS A PROXY FOR the number of logical defects STILL present in your code
18
4 LOGICAL ERRORS
19
[Why are the tests failing? Choose best answer A.[System does not know what it is doing] B.[LED 6 is on, when it should be off] C.[LED 6 is off, when it should be on] D.[InitFlashCPP( ) and InitFlashPortCPP( ) not called] E.[All of above]
20
The FIX to start in state2 causes earlier tests to fail
21
When we call “FlashLED6 ( )” – the result depends on what happened before If another test has called 3 FlashLED( ), then the Test passes. But if another test has called 4 FlashLED( ), the test fails Slide shows initialization of FlashLED6 and fixed tests to use the new function
22
The problems with SimpleTest work – but destroy other states currentLED6 is now a global variable
23
Fix the code But it still fails
24
[Where does the problem remain?] A.[Outside this code] B.[In Lines 28 30] C.[Logic of State1] D.[InitFlashCPP( ) and InitFlashPortCPP( ) not called] E.[Logic of State 2]
25
Init Flash6, Run the Flash 6 task and destroy it after 20 seconds
26
Slightly different task in Lab3 Write tests to u se SW3 to change LED5 flash rate If switch 3 ‘accidently’ touched – do nothing to LED5 flash rate If switch 3 is held and released after a ‘short’ time, then decrease flash rate each time released If switch 3 is held and released after a ‘long’ time, then increase flash rate each time released
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.